You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(98) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@op...> - 2024-09-23 19:34:57
|
Author: manx Date: Mon Sep 23 21:34:50 2024 New Revision: 21716 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21716 Log: [Var] ASIO::Modern: Update to v0.12.10 Modified: trunk/OpenMPT/include/asiomodern/OpenMPT.txt trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOSampleConvert.hpp trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOVersion.hpp Modified: trunk/OpenMPT/include/asiomodern/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/asiomodern/OpenMPT.txt Mon Sep 23 21:21:43 2024 (r21715) +++ trunk/OpenMPT/include/asiomodern/OpenMPT.txt Mon Sep 23 21:34:50 2024 (r21716) @@ -1 +1 @@ -ASIO::Modern v0.12.9 +ASIO::Modern v0.12.10 Modified: trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOSampleConvert.hpp ============================================================================== --- trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOSampleConvert.hpp Mon Sep 23 21:21:43 2024 (r21715) +++ trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOSampleConvert.hpp Mon Sep 23 21:34:50 2024 (r21716) @@ -10,6 +10,7 @@ #include <algorithm> #include <array> +#include <iterator> #include <limits> #include <type_traits> Modified: trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOVersion.hpp ============================================================================== --- trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOVersion.hpp Mon Sep 23 21:21:43 2024 (r21715) +++ trunk/OpenMPT/include/asiomodern/include/ASIOModern/ASIOVersion.hpp Mon Sep 23 21:34:50 2024 (r21716) @@ -17,7 +17,7 @@ #define ASIO_MODERNSDK_VERSION_MAJOR 0 #define ASIO_MODERNSDK_VERSION_MINOR 12 -#define ASIO_MODERNSDK_VERSION_PATCH 9 +#define ASIO_MODERNSDK_VERSION_PATCH 10 #define ASIO_MODERNSDK_VERSION_BUILD 0 |
From: <sv...@op...> - 2024-09-23 19:21:55
|
Author: manx Date: Mon Sep 23 21:21:43 2024 New Revision: 21715 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21715 Log: [Fix] openmpt123: Do not swallow buffered text output on exit. Broken since r21704. Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 21:02:12 2024 (r21714) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 21:21:43 2024 (r21715) @@ -194,7 +194,9 @@ class textout_dummy : public textout { public: textout_dummy() = default; - ~textout_dummy() override = default; + ~textout_dummy() override { + static_cast<void>( pop() ); + } public: void writeout() override { static_cast<void>( pop() ); @@ -378,7 +380,9 @@ #endif public: textout_wrapper() = default; - ~textout_wrapper() override = default; + ~textout_wrapper() override { + out.write( pop() ); + } public: void writeout() override { out.write( pop() ); |
From: <sv...@op...> - 2024-09-23 19:02:24
|
Author: manx Date: Mon Sep 23 21:02:12 2024 New Revision: 21714 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21714 Log: Merged revision(s) 21710 from trunk/OpenMPT: [Fix] mpt/random/device.hpp: Add missing include. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/src/mpt/random/device.hpp Modified: branches/OpenMPT-1.30/src/mpt/random/device.hpp ============================================================================== --- branches/OpenMPT-1.30/src/mpt/random/device.hpp Mon Sep 23 21:01:35 2024 (r21713) +++ branches/OpenMPT-1.30/src/mpt/random/device.hpp Mon Sep 23 21:02:12 2024 (r21714) @@ -20,6 +20,7 @@ #include "mpt/random/random.hpp" #include <chrono> +#include <iterator> #include <limits> #include <memory> #include <random> |
From: <sv...@op...> - 2024-09-23 19:01:47
|
Author: manx Date: Mon Sep 23 21:01:35 2024 New Revision: 21713 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21713 Log: Merged revision(s) 21709 from trunk/OpenMPT: [Fix] mpt/string/buffer.hpp: Add missing include. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/src/mpt/string/buffer.hpp Modified: branches/OpenMPT-1.30/src/mpt/string/buffer.hpp ============================================================================== --- branches/OpenMPT-1.30/src/mpt/string/buffer.hpp Mon Sep 23 21:01:01 2024 (r21712) +++ branches/OpenMPT-1.30/src/mpt/string/buffer.hpp Mon Sep 23 21:01:35 2024 (r21713) @@ -13,6 +13,7 @@ #include <algorithm> #include <array> +#include <iterator> #include <string> #include <string_view> #include <type_traits> |
From: <sv...@op...> - 2024-09-23 19:01:12
|
Author: manx Date: Mon Sep 23 21:01:01 2024 New Revision: 21712 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21712 Log: Merged revision(s) 21710 from trunk/OpenMPT: [Fix] mpt/random/device.hpp: Add missing include. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/src/mpt/random/device.hpp Modified: branches/OpenMPT-1.31/src/mpt/random/device.hpp ============================================================================== --- branches/OpenMPT-1.31/src/mpt/random/device.hpp Mon Sep 23 21:00:20 2024 (r21711) +++ branches/OpenMPT-1.31/src/mpt/random/device.hpp Mon Sep 23 21:01:01 2024 (r21712) @@ -22,6 +22,7 @@ #if !defined(MPT_LIBCXX_QUIRK_NO_CHRONO) #include <chrono> #endif // !MPT_LIBCXX_QUIRK_NO_CHRONO +#include <iterator> #include <limits> #include <memory> #include <random> |
From: <sv...@op...> - 2024-09-23 19:00:32
|
Author: manx Date: Mon Sep 23 21:00:20 2024 New Revision: 21711 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21711 Log: Merged revision(s) 21709 from trunk/OpenMPT: [Fix] mpt/string/buffer.hpp: Add missing include. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/src/mpt/string/buffer.hpp Modified: branches/OpenMPT-1.31/src/mpt/string/buffer.hpp ============================================================================== --- branches/OpenMPT-1.31/src/mpt/string/buffer.hpp Mon Sep 23 20:59:44 2024 (r21710) +++ branches/OpenMPT-1.31/src/mpt/string/buffer.hpp Mon Sep 23 21:00:20 2024 (r21711) @@ -14,6 +14,7 @@ #include <algorithm> #include <array> +#include <iterator> #include <string> #include <string_view> #include <type_traits> |
From: <sv...@op...> - 2024-09-23 18:59:56
|
Author: manx Date: Mon Sep 23 20:59:44 2024 New Revision: 21710 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21710 Log: [Fix] mpt/random/device.hpp: Add missing include. Modified: trunk/OpenMPT/src/mpt/random/device.hpp Modified: trunk/OpenMPT/src/mpt/random/device.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/random/device.hpp Mon Sep 23 20:58:20 2024 (r21709) +++ trunk/OpenMPT/src/mpt/random/device.hpp Mon Sep 23 20:59:44 2024 (r21710) @@ -22,6 +22,7 @@ #if !defined(MPT_LIBCXX_QUIRK_NO_CHRONO) #include <chrono> #endif // !MPT_LIBCXX_QUIRK_NO_CHRONO +#include <iterator> #include <limits> #include <memory> #include <random> |
From: <sv...@op...> - 2024-09-23 18:58:32
|
Author: manx Date: Mon Sep 23 20:58:20 2024 New Revision: 21709 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21709 Log: [Fix] mpt/string/buffer.hpp: Add missing include. Modified: trunk/OpenMPT/src/mpt/string/buffer.hpp Modified: trunk/OpenMPT/src/mpt/string/buffer.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/string/buffer.hpp Mon Sep 23 20:46:13 2024 (r21708) +++ trunk/OpenMPT/src/mpt/string/buffer.hpp Mon Sep 23 20:58:20 2024 (r21709) @@ -14,6 +14,7 @@ #include <algorithm> #include <array> +#include <iterator> #include <string> #include <string_view> #include <type_traits> |
From: <sv...@op...> - 2024-09-23 18:46:25
|
Author: manx Date: Mon Sep 23 20:46:13 2024 New Revision: 21708 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21708 Log: [Ref] openmpt123: Older clang has stupid opinions about coding style. Use override instead of final, it does not really matter here. Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 20:41:06 2024 (r21707) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 20:46:13 2024 (r21708) @@ -194,12 +194,12 @@ class textout_dummy : public textout { public: textout_dummy() = default; - ~textout_dummy() final = default; + ~textout_dummy() override = default; public: - void writeout() final { + void writeout() override { static_cast<void>( pop() ); } - void cursor_up( std::size_t lines ) final { + void cursor_up( std::size_t lines ) override { static_cast<void>( lines ); } }; @@ -241,9 +241,9 @@ #endif return; } - ~textout_ostream() final = default; + ~textout_ostream() override = default; public: - void write( const mpt::ustring & text ) final { + void write( const mpt::ustring & text ) override { if ( text.length() > 0 ) { #if MPT_OS_DJGPP s << mpt::transcode<std::string>( codepage, text ); @@ -255,7 +255,7 @@ s.flush(); } } - void cursor_up( std::size_t lines ) final { + void cursor_up( std::size_t lines ) override { s.flush(); for ( std::size_t line = 0; line < lines; ++line ) { s << std::string("\x1b[1A"); @@ -274,15 +274,15 @@ { return; } - ~textout_wostream() final = default; + ~textout_wostream() override = default; public: - void write( const mpt::ustring & text ) final { + void write( const mpt::ustring & text ) override { if ( text.length() > 0 ) { s << mpt::transcode<std::wstring>( text ); s.flush(); } } - void cursor_up( std::size_t lines ) final { + void cursor_up( std::size_t lines ) override { s.flush(); for ( std::size_t line = 0; line < lines; ++line ) { s << std::wstring(L"\x1b[1A"); @@ -315,9 +315,9 @@ { return; } - ~textout_ostream_console() final = default; + ~textout_ostream_console() override = default; public: - void write( const mpt::ustring & text ) final { + void write( const mpt::ustring & text ) override { if ( text.length() > 0 ) { if ( console ) { DWORD chars_written = 0; @@ -338,7 +338,7 @@ } } } - void cursor_up( std::size_t lines ) final { + void cursor_up( std::size_t lines ) override { if ( console ) { s.flush(); CONSOLE_SCREEN_BUFFER_INFO csbi; @@ -378,12 +378,12 @@ #endif public: textout_wrapper() = default; - ~textout_wrapper() final = default; + ~textout_wrapper() override = default; public: - void writeout() final { + void writeout() override { out.write( pop() ); } - void cursor_up(std::size_t lines) final { + void cursor_up(std::size_t lines) override { out.cursor_up( lines ); } }; |
From: <sv...@op...> - 2024-09-23 18:41:14
|
Author: manx Date: Mon Sep 23 20:41:06 2024 New Revision: 21707 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21707 Log: [Fix] openmpt123: Support older compilers that do not support [[maybe_unused]]. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 20:05:37 2024 (r21706) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 20:41:06 2024 (r21707) @@ -2264,10 +2264,10 @@ const FILE_mode stdin_mode = mpt::contains( flags.filenames, MPT_NATIVE_PATH("-") ) ? FILE_mode::binary : FILE_mode::text; const FILE_mode stdout_mode = flags.use_stdout ? FILE_mode::binary : FILE_mode::text; - [[maybe_unused]] const bool stdin_text = ( stdin_mode == FILE_mode::text ); - [[maybe_unused]] const bool stdin_data = ( stdin_mode == FILE_mode::binary ); - [[maybe_unused]] const bool stdout_text = ( stdout_mode == FILE_mode::text ); - [[maybe_unused]] const bool stdout_data = ( stdout_mode == FILE_mode::binary ); + const bool stdin_text = ( stdin_mode == FILE_mode::text ); + const bool stdin_data = ( stdin_mode == FILE_mode::binary ); + const bool stdout_text = ( stdout_mode == FILE_mode::text ); + const bool stdout_data = ( stdout_mode == FILE_mode::binary ); // set stdin/stdout to binary for data input/output std::optional<FILE_mode_guard> stdin_guard{ stdin_data ? std::make_optional<FILE_mode_guard>( stdin, FILE_mode::binary ) : std::nullopt }; @@ -2279,6 +2279,11 @@ // choose text output between quiet/stdout/stderr textout & log = flags.quiet ? static_cast<textout&>( dummy_log ) : stdout_text ? static_cast<textout&>( std_out ) : static_cast<textout&>( std_err ); + MPT_UNUSED( stdin_text ); + MPT_UNUSED( stdin_data ); + MPT_UNUSED( stdout_text ); + MPT_UNUSED( stdout_data ); + show_banner( log, flags.banner ); if ( !flags.warnings.empty() ) { |
From: <sv...@op...> - 2024-09-23 18:05:48
|
Author: manx Date: Mon Sep 23 20:05:37 2024 New Revision: 21706 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21706 Log: [Fix] mpt/base/algorithm.hpp: Add missing include. Modified: trunk/OpenMPT/src/mpt/base/algorithm.hpp Modified: trunk/OpenMPT/src/mpt/base/algorithm.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/base/algorithm.hpp Mon Sep 23 20:01:00 2024 (r21705) +++ trunk/OpenMPT/src/mpt/base/algorithm.hpp Mon Sep 23 20:05:37 2024 (r21706) @@ -11,6 +11,7 @@ #include "mpt/base/saturate_cast.hpp" #include <algorithm> +#include <iterator> #include <limits> #include <type_traits> |
From: <sv...@op...> - 2024-09-23 18:01:14
|
Author: manx Date: Mon Sep 23 20:01:00 2024 New Revision: 21705 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21705 Log: [Fix] openmpt123: Fix typo. Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 19:58:52 2024 (r21704) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 20:01:00 2024 (r21705) @@ -371,10 +371,10 @@ #if defined(UNICODE) textout_wostream out{ dest == textout_destination::destination_stdout ? std::wcout : std::wclog }; #else - textout_wostream out{ dest == textout_destination::destination_stdout ? std::cout : std::clog }; + textout_ostream out{ dest == textout_destination::destination_stdout ? std::cout : std::clog }; #endif #else - textout_wostream out{ dest == textout_destination::destination_stdout ? std::cout : std::clog }; + textout_ostream out{ dest == textout_destination::destination_stdout ? std::cout : std::clog }; #endif public: textout_wrapper() = default; |
From: <sv...@op...> - 2024-09-23 17:58:59
|
Author: manx Date: Mon Sep 23 19:58:52 2024 New Revision: 21704 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21704 Log: [Ref] openmpt123: Split textout buffer handling from textout backends. [Ref] openmpt123: Move platform-specific textout backend selection into textout_wrapper. [Ref] openmpt123: Avoid pushing cursor_up() through redundant transcoding. [Ref] openmpt123: Simplify platform-specific initialization in main(). [Ref] openmpt123: Cleanup FILE_mode_guard. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 19:31:44 2024 (r21703) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 19:58:52 2024 (r21704) @@ -45,6 +45,7 @@ #include <sys/types.h> #endif +#include "mpt/base/algorithm.hpp" #include "mpt/base/detect.hpp" #include "mpt/main/main.hpp" @@ -2078,8 +2079,7 @@ } enum class FILE_mode { - unchanged, - utf8, + text, binary, }; @@ -2095,7 +2095,7 @@ , old_mode(-1) { switch (new_mode) { - case FILE_mode::utf8: + case FILE_mode::text: fflush( file ); #if defined(UNICODE) old_mode = _setmode( _fileno( file ), _O_U8TEXT ); @@ -2113,11 +2113,12 @@ throw exception( MPT_USTRING("failed to set binary mode on file descriptor") ); } break; - default: - // nothing - break; } } + FILE_mode_guard( const FILE_mode_guard & ) = delete; + FILE_mode_guard( FILE_mode_guard && ) = default; + FILE_mode_guard & operator=( const FILE_mode_guard & ) = delete; + FILE_mode_guard & operator=( FILE_mode_guard && ) = default; ~FILE_mode_guard() { if ( old_mode != -1 ) { fflush( file ); @@ -2140,10 +2141,13 @@ class FILE_mode_guard { public: - FILE_mode_guard( FILE * /* file */, FILE_mode /* new_mode */ ) - { + FILE_mode_guard( FILE * /* file */, FILE_mode /* new_mode */ ) { return; } + FILE_mode_guard( const FILE_mode_guard & ) = delete; + FILE_mode_guard( FILE_mode_guard && ) = default; + FILE_mode_guard & operator=( const FILE_mode_guard & ) = delete; + FILE_mode_guard & operator=( FILE_mode_guard && ) = default; ~FILE_mode_guard() = default; }; @@ -2180,30 +2184,13 @@ static mpt::uint8 main( std::vector<mpt::ustring> args ) { - FILE_mode_guard stdin_utf8_guard( stdin, FILE_mode::utf8 ); - FILE_mode_guard stdout_utf8_guard( stdout, FILE_mode::utf8 ); - FILE_mode_guard stderr_utf8_guard( stderr, FILE_mode::utf8 ); + FILE_mode_guard stdin_text_guard( stdin, FILE_mode::text ); + FILE_mode_guard stdout_text_guard( stdout, FILE_mode::text ); + FILE_mode_guard stderr_text_guard( stderr, FILE_mode::text ); + textout_dummy dummy_log; -#if MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) -#if defined(UNICODE) - textout_ostream_console std_out( std::wcout, STD_OUTPUT_HANDLE ); - textout_ostream_console std_err( std::wclog, STD_ERROR_HANDLE ); -#else - textout_ostream_console std_out( std::cout, STD_OUTPUT_HANDLE ); - textout_ostream_console std_err( std::clog, STD_ERROR_HANDLE ); -#endif -#elif MPT_OS_WINDOWS -#if defined(UNICODE) - textout_wostream std_out( std::wcout ); - textout_wostream std_err( std::wclog ); -#else - textout_ostream std_out( std::cout ); - textout_ostream std_err( std::clog ); -#endif -#else - textout_ostream std_out( std::cout ); - textout_ostream std_err( std::clog ); -#endif + textout_wrapper<textout_destination::destination_stdout> std_out; + textout_wrapper<textout_destination::destination_stderr> std_err; commandlineflags flags; @@ -2274,29 +2261,23 @@ try { - bool stdin_can_ui = true; - for ( const auto & filename : flags.filenames ) { - if ( filename == MPT_NATIVE_PATH("-") ) { - stdin_can_ui = false; - break; - } - } - - bool stdout_can_ui = true; - if ( flags.use_stdout ) { - stdout_can_ui = false; - } + const FILE_mode stdin_mode = mpt::contains( flags.filenames, MPT_NATIVE_PATH("-") ) ? FILE_mode::binary : FILE_mode::text; + const FILE_mode stdout_mode = flags.use_stdout ? FILE_mode::binary : FILE_mode::text; - // set stdin binary - FILE_mode_guard stdin_guard( stdin, stdin_can_ui ? FILE_mode::unchanged : FILE_mode::binary ); + [[maybe_unused]] const bool stdin_text = ( stdin_mode == FILE_mode::text ); + [[maybe_unused]] const bool stdin_data = ( stdin_mode == FILE_mode::binary ); + [[maybe_unused]] const bool stdout_text = ( stdout_mode == FILE_mode::text ); + [[maybe_unused]] const bool stdout_data = ( stdout_mode == FILE_mode::binary ); + + // set stdin/stdout to binary for data input/output + std::optional<FILE_mode_guard> stdin_guard{ stdin_data ? std::make_optional<FILE_mode_guard>( stdin, FILE_mode::binary ) : std::nullopt }; + std::optional<FILE_mode_guard> stdout_guard{ stdout_data ? std::make_optional<FILE_mode_guard>( stdout, FILE_mode::binary ) : std::nullopt }; - // set stdout binary - FILE_mode_guard stdout_guard( stdout, stdout_can_ui ? FILE_mode::unchanged : FILE_mode::binary ); + // setup terminal + std::optional<terminal_ui_guard> input_guard{ stdin_text && ( flags.mode == Mode::UI ) ? std::make_optional<terminal_ui_guard>() : std::nullopt }; - // setup terminal for ui mode - std::optional<terminal_ui_guard> input_guard{ ( stdin_can_ui && ( flags.mode == Mode::UI ) ? std::make_optional<terminal_ui_guard>() : std::nullopt ) }; - - textout & log = flags.quiet ? static_cast<textout&>( dummy_log ) : static_cast<textout&>( stdout_can_ui ? std_out : std_err ); + // choose text output between quiet/stdout/stderr + textout & log = flags.quiet ? static_cast<textout&>( dummy_log ) : stdout_text ? static_cast<textout&>( std_out ) : static_cast<textout&>( std_err ); show_banner( log, flags.banner ); Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 19:31:44 2024 (r21703) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Mon Sep 23 19:58:52 2024 (r21704) @@ -174,13 +174,10 @@ class textout : public string_concat_stream<mpt::ustring> { +protected: + textout() = default; public: - textout() { - return; - } - virtual ~textout() { - return; - } + virtual ~textout() = default; protected: mpt::ustring pop() { mpt::ustring text = str(); @@ -189,26 +186,44 @@ } public: virtual void writeout() = 0; - virtual void cursor_up( std::size_t lines ) { - static_cast<void>( lines ); - } + virtual void cursor_up( std::size_t lines ) = 0; }; + + class textout_dummy : public textout { public: - textout_dummy() { - return; - } - virtual ~textout_dummy() { - return; - } + textout_dummy() = default; + ~textout_dummy() final = default; public: - void writeout() override { + void writeout() final { static_cast<void>( pop() ); } + void cursor_up( std::size_t lines ) final { + static_cast<void>( lines ); + } }; -class textout_ostream : public textout { + + +enum class textout_destination { + destination_stdout, + destination_stderr, +}; + +class textout_backend { +protected: + textout_backend() = default; +public: + virtual ~textout_backend() = default; +public: + virtual void write( const mpt::ustring & text ) = 0; + virtual void cursor_up(std::size_t lines) = 0; +}; + + + +class textout_ostream : public textout_backend { private: std::ostream & s; #if MPT_OS_DJGPP @@ -226,12 +241,9 @@ #endif return; } - virtual ~textout_ostream() { - writeout_impl(); - } -private: - void writeout_impl() { - mpt::ustring text = pop(); + ~textout_ostream() final = default; +public: + void write( const mpt::ustring & text ) final { if ( text.length() > 0 ) { #if MPT_OS_DJGPP s << mpt::transcode<std::string>( codepage, text ); @@ -243,21 +255,17 @@ s.flush(); } } -public: - void writeout() override { - writeout_impl(); - } - void cursor_up( std::size_t lines ) override { + void cursor_up( std::size_t lines ) final { s.flush(); for ( std::size_t line = 0; line < lines; ++line ) { - *this << MPT_USTRING("\x1b[1A"); + s << std::string("\x1b[1A"); } } }; #if MPT_OS_WINDOWS && defined(UNICODE) -class textout_wostream : public textout { +class textout_wostream : public textout_backend { private: std::wostream & s; public: @@ -266,25 +274,18 @@ { return; } - virtual ~textout_wostream() { - writeout_impl(); - } -private: - void writeout_impl() { - mpt::ustring text = pop(); + ~textout_wostream() final = default; +public: + void write( const mpt::ustring & text ) final { if ( text.length() > 0 ) { s << mpt::transcode<std::wstring>( text ); s.flush(); } } -public: - void writeout() override { - writeout_impl(); - } - void cursor_up( std::size_t lines ) override { + void cursor_up( std::size_t lines ) final { s.flush(); for ( std::size_t line = 0; line < lines; ++line ) { - *this << MPT_USTRING("\x1b[1A"); + s << std::wstring(L"\x1b[1A"); } } }; @@ -293,7 +294,7 @@ #if MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) -class textout_ostream_console : public textout { +class textout_ostream_console : public textout_backend { private: #if defined(UNICODE) std::wostream & s; @@ -314,12 +315,9 @@ { return; } - virtual ~textout_ostream_console() { - writeout_impl(); - } -private: - void writeout_impl() { - mpt::ustring text = pop(); + ~textout_ostream_console() final = default; +public: + void write( const mpt::ustring & text ) final { if ( text.length() > 0 ) { if ( console ) { DWORD chars_written = 0; @@ -340,11 +338,7 @@ } } } -public: - void writeout() override { - writeout_impl(); - } - void cursor_up( std::size_t lines ) override { + void cursor_up( std::size_t lines ) final { if ( console ) { s.flush(); CONSOLE_SCREEN_BUFFER_INFO csbi; @@ -362,6 +356,40 @@ #endif // MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) + + +template <textout_destination dest> +class textout_wrapper : public textout { +private: +#if MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) +#if defined(UNICODE) + textout_ostream_console out{ dest == textout_destination::destination_stdout ? std::wcout : std::wclog, dest == textout_destination::destination_stdout ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE }; +#else + textout_ostream_console out{ dest == textout_destination::destination_stdout ? std::cout : std::clog, dest == textout_destination::destination_stdout ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE }; +#endif +#elif MPT_OS_WINDOWS +#if defined(UNICODE) + textout_wostream out{ dest == textout_destination::destination_stdout ? std::wcout : std::wclog }; +#else + textout_wostream out{ dest == textout_destination::destination_stdout ? std::cout : std::clog }; +#endif +#else + textout_wostream out{ dest == textout_destination::destination_stdout ? std::cout : std::clog }; +#endif +public: + textout_wrapper() = default; + ~textout_wrapper() final = default; +public: + void writeout() final { + out.write( pop() ); + } + void cursor_up(std::size_t lines) final { + out.cursor_up( lines ); + } +}; + + + inline mpt::ustring append_software_tag( mpt::ustring software ) { mpt::ustring openmpt123 = mpt::ustring() + MPT_USTRING("openmpt123 ") |
From: <sv...@op...> - 2024-09-23 17:31:50
|
Author: manx Date: Mon Sep 23 19:31:44 2024 New Revision: 21703 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21703 Log: [Ref] openmpt123: Cleanup setting up terminal for UI mode. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 18:43:33 2024 (r21702) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 19:31:44 2024 (r21703) @@ -2126,12 +2126,14 @@ } }; -class terminal_input_guard { +class terminal_ui_guard { public: - terminal_input_guard( bool /* enable */ ) { - return; - } - ~terminal_input_guard() = default; + terminal_ui_guard() = default; + terminal_ui_guard( const terminal_ui_guard & ) = delete; + terminal_ui_guard( terminal_ui_guard && ) = default; + terminal_ui_guard & operator=( const terminal_ui_guard & ) = delete; + terminal_ui_guard & operator=( terminal_ui_guard && ) = default; + ~terminal_ui_guard() = default; }; #else @@ -2145,28 +2147,28 @@ ~FILE_mode_guard() = default; }; -class terminal_input_guard { +class terminal_ui_guard { private: bool changed = false; termios saved_attributes; public: - terminal_input_guard( bool enable ) { - if ( !enable ) { - return; - } - termios tattr; + terminal_ui_guard() { if ( !isatty( STDIN_FILENO ) ) { return; } tcgetattr( STDIN_FILENO, &saved_attributes ); - tcgetattr( STDIN_FILENO, &tattr ); + termios tattr = saved_attributes; tattr.c_lflag &= ~( ICANON | ECHO ); tattr.c_cc[VMIN] = 1; tattr.c_cc[VTIME] = 0; tcsetattr( STDIN_FILENO, TCSAFLUSH, &tattr ); changed = true; } - ~terminal_input_guard() { + terminal_ui_guard( const terminal_ui_guard & ) = delete; + terminal_ui_guard( terminal_ui_guard && ) = default; + terminal_ui_guard & operator=( const terminal_ui_guard & ) = delete; + terminal_ui_guard & operator=( terminal_ui_guard && ) = default; + ~terminal_ui_guard() { if ( changed ) { tcsetattr(STDIN_FILENO, TCSANOW, &saved_attributes); } @@ -2291,8 +2293,8 @@ // set stdout binary FILE_mode_guard stdout_guard( stdout, stdout_can_ui ? FILE_mode::unchanged : FILE_mode::binary ); - // setup terminal - terminal_input_guard input_guard( stdin_can_ui && ( flags.mode == Mode::UI ) ); + // setup terminal for ui mode + std::optional<terminal_ui_guard> input_guard{ ( stdin_can_ui && ( flags.mode == Mode::UI ) ? std::make_optional<terminal_ui_guard>() : std::nullopt ) }; textout & log = flags.quiet ? static_cast<textout&>( dummy_log ) : static_cast<textout&>( stdout_can_ui ? std_out : std_err ); |
From: <sv...@op...> - 2024-09-23 16:43:39
|
Author: manx Date: Mon Sep 23 18:43:33 2024 New Revision: 21702 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21702 Log: [Ref] mpt/main/main.hpp: Add back comment about extern "C" wmain. Modified: trunk/OpenMPT/src/mpt/main/main.hpp Modified: trunk/OpenMPT/src/mpt/main/main.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/main/main.hpp Mon Sep 23 18:38:01 2024 (r21701) +++ trunk/OpenMPT/src/mpt/main/main.hpp Mon Sep 23 18:43:33 2024 (r21702) @@ -85,6 +85,7 @@ #if MPT_OS_WINDOWS && (MPT_COMPILER_GCC || MPT_COMPILER_CLANG) #if defined(UNICODE) +// mingw64 does only default to special C linkage for "main", but not for "wmain". #define MPT_MAIN_DECL extern "C" int wmain(int argc, wchar_t * argv[]); #endif #endif |
From: <sv...@op...> - 2024-09-23 16:38:13
|
Author: manx Date: Mon Sep 23 18:38:01 2024 New Revision: 21701 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21701 Log: [Var] mpt/main/main.hpp: Cleanup formatting. Modified: trunk/OpenMPT/src/mpt/main/main.hpp Modified: trunk/OpenMPT/src/mpt/main/main.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/main/main.hpp Mon Sep 23 18:23:23 2024 (r21700) +++ trunk/OpenMPT/src/mpt/main/main.hpp Mon Sep 23 18:38:01 2024 (r21701) @@ -107,7 +107,9 @@ #endif // MPT_OS_DJGPP #if !defined(MPT_MAIN_PROLOG) +/* clang-format off */ #define MPT_MAIN_PROLOG() do { } while(0) +/* clang-format on */ #endif |
Author: manx Date: Mon Sep 23 18:23:23 2024 New Revision: 21700 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21700 Log: [Ref] openmpt123: Use mpt/main. Modified: trunk/OpenMPT/build/premake/mpt-openmpt123.lua trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj.filters trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj.filters trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/build/premake/mpt-openmpt123.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-openmpt123.lua Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/premake/mpt-openmpt123.lua Mon Sep 23 18:23:23 2024 (r21700) @@ -32,6 +32,7 @@ "../../src/mpt/format/*.hpp", "../../src/mpt/io/*.hpp", "../../src/mpt/io_file/*.hpp", + "../../src/mpt/main/*.hpp", "../../src/mpt/parse/*.hpp", "../../src/mpt/path/*.hpp", "../../src/mpt/random/*.hpp", Modified: trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -813,6 +813,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2017winxp/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -31,6 +31,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -288,6 +291,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -813,6 +813,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2017winxpansi/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -31,6 +31,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -288,6 +291,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -810,6 +810,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2019win7/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -37,6 +37,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -294,6 +297,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -1588,6 +1588,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win10/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -37,6 +37,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -294,6 +297,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -1506,6 +1506,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win10clang/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -37,6 +37,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -294,6 +297,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -830,6 +830,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win7/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -37,6 +37,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -294,6 +297,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -1200,6 +1200,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win8/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -37,6 +37,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -294,6 +297,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj Mon Sep 23 18:23:23 2024 (r21700) @@ -1200,6 +1200,7 @@ <ClInclude Include="..\..\src\mpt\io_file\fstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\inputfile.hpp" /> <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\parse\parse.hpp" /> <ClInclude Include="..\..\src\mpt\parse\split.hpp" /> <ClInclude Include="..\..\src\mpt\path\basic_path.hpp" /> Modified: trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj.filters Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/build/vs2022win81/openmpt123.vcxproj.filters Mon Sep 23 18:23:23 2024 (r21700) @@ -37,6 +37,9 @@ <Filter Include="src\mpt\io_file"> <UniqueIdentifier>{D34C5655-3FD8-C319-48E9-460EB4F31F1A}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\parse"> <UniqueIdentifier>{B706C87E-23C7-43B5-EC01-8D3258818891}</UniqueIdentifier> </Filter> @@ -294,6 +297,9 @@ <ClInclude Include="..\..\src\mpt\io_file\outputfile.hpp"> <Filter>src\mpt\io_file</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\parse\parse.hpp"> <Filter>src\mpt\parse</Filter> </ClInclude> Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 18:20:59 2024 (r21699) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 18:23:23 2024 (r21700) @@ -45,8 +45,8 @@ #include <sys/types.h> #endif -#include "mpt/base/check_platform.hpp" #include "mpt/base/detect.hpp" +#include "mpt/main/main.hpp" #include "mpt/random/crand.hpp" #include "mpt/random/default_engines.hpp" @@ -79,7 +79,6 @@ #if MPT_OS_DJGPP #include <conio.h> -#include <crt0.h> #include <dpmi.h> #include <fcntl.h> #include <io.h> @@ -2176,37 +2175,8 @@ #endif -#if MPT_OS_DJGPP -/* Work-around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45977> */ -/* clang-format off */ -extern "C" { - int _crt0_startup_flags = 0 - | _CRT0_FLAG_NONMOVE_SBRK /* force interrupt compatible allocation */ - | _CRT0_DISABLE_SBRK_ADDRESS_WRAP /* force NT compatible allocation */ - | _CRT0_FLAG_LOCK_MEMORY /* lock all code and data at program startup */ - | 0; -} -/* clang-format on */ -#endif /* MPT_OS_DJGPP */ -#if MPT_OS_WINDOWS && defined(UNICODE) -static int wmain( int wargc, wchar_t * wargv [] ) { -#else -static int main( int argc, char * argv [] ) { -#endif - #if MPT_OS_DJGPP - _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; /* disable automatic locking for all further memory allocations */ - assert(mpt::platform::libc().is_ok()); - #endif /* MPT_OS_DJGPP */ - std::vector<mpt::ustring> args; - #if MPT_OS_WINDOWS && defined(UNICODE) - for ( int arg = 0; arg < wargc; ++arg ) { - args.push_back( mpt::transcode<mpt::ustring>( wargv[arg] ) ); - } - #else - for ( int arg = 0; arg < argc; ++arg ) { - args.push_back( mpt::transcode<mpt::ustring>( mpt::logical_encoding::locale, argv[arg] ) ); - } - #endif + +static mpt::uint8 main( std::vector<mpt::ustring> args ) { FILE_mode_guard stdin_utf8_guard( stdin, FILE_mode::utf8 ); FILE_mode_guard stdout_utf8_guard( stdout, FILE_mode::utf8 ); @@ -2455,17 +2425,5 @@ } // namespace openmpt123 -#if MPT_OS_WINDOWS && defined(UNICODE) -#if defined(__GNUC__) || (defined(__clang__) && !defined(_MSC_VER)) -// mingw64 does only default to special C linkage for "main", but not for "wmain". -extern "C" int wmain( int wargc, wchar_t * wargv [] ); -extern "C" -#endif -int wmain( int wargc, wchar_t * wargv [] ) { - return openmpt123::wmain( wargc, wargv ); -} -#else -int main( int argc, char * argv [] ) { - return openmpt123::main( argc, argv ); -} -#endif + +MPT_MAIN_IMPLEMENT_MAIN(openmpt123) |
From: <sv...@op...> - 2024-09-23 16:21:12
|
Author: manx Date: Mon Sep 23 18:20:59 2024 New Revision: 21699 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21699 Log: [Ref] mpt/main/main.hpp: Add main library that abstracts away platform-specific non-standard handling of main(), like Win32 wmain, MinGW missing prototypes, and DJGPP crt0 flags. Added: trunk/OpenMPT/src/mpt/main/ trunk/OpenMPT/src/mpt/main/main.hpp (contents, props changed) Modified: trunk/OpenMPT/Makefile trunk/OpenMPT/build/autotools/Makefile.am trunk/OpenMPT/build/autotools/autoconfiscate.sh trunk/OpenMPT/build/premake-xcode/mpt-libopenmpt.lua trunk/OpenMPT/build/premake/mpt-OpenMPT-NativeSupport.lua trunk/OpenMPT/build/premake/mpt-OpenMPT.lua trunk/OpenMPT/build/premake/mpt-PluginBridge.lua trunk/OpenMPT/build/premake/mpt-libopenmpt-small.lua trunk/OpenMPT/build/premake/mpt-libopenmpt.lua trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua trunk/OpenMPT/build/premake/mpt-updatesigntool.lua Modified: trunk/OpenMPT/Makefile ============================================================================== --- trunk/OpenMPT/Makefile Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/Makefile Mon Sep 23 18:20:59 2024 (r21699) @@ -1835,6 +1835,7 @@ svn export ./src/mpt/io_write bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/io_write #svn export ./src/mpt/json bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/json #svn export ./src/mpt/library bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/library + svn export ./src/mpt/main bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/main svn export ./src/mpt/mutex bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/mutex svn export ./src/mpt/out_of_memory bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/out_of_memory svn export ./src/mpt/osinfo bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/osinfo @@ -1935,6 +1936,7 @@ svn export ./src/mpt/io_write bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/io_write --native-eol CRLF #svn export ./src/mpt/json bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/json --native-eol CRLF #svn export ./src/mpt/library bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/library --native-eol CRLF + svn export ./src/mpt/main bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/main --native-eol CRLF svn export ./src/mpt/mutex bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/mutex --native-eol CRLF svn export ./src/mpt/out_of_memory bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/out_of_memory --native-eol CRLF svn export ./src/mpt/osinfo bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/src/mpt/osinfo --native-eol CRLF Modified: trunk/OpenMPT/build/autotools/Makefile.am ============================================================================== --- trunk/OpenMPT/build/autotools/Makefile.am Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/autotools/Makefile.am Mon Sep 23 18:20:59 2024 (r21699) @@ -238,6 +238,7 @@ MPT_FILES_SRC_MPT += src/mpt/io_write/buffer.hpp #MPT_FILES_SRC_MPT += src/mpt/json/json.hpp #MPT_FILES_SRC_MPT += src/mpt/library/library.hpp +MPT_FILES_SRC_MPT += src/mpt/main/main.hpp MPT_FILES_SRC_MPT += src/mpt/mutex/mutex.hpp MPT_FILES_SRC_MPT += src/mpt/osinfo/class.hpp MPT_FILES_SRC_MPT += src/mpt/osinfo/dos_memory.hpp Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh ============================================================================== --- trunk/OpenMPT/build/autotools/autoconfiscate.sh Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/autotools/autoconfiscate.sh Mon Sep 23 18:20:59 2024 (r21699) @@ -89,6 +89,7 @@ svn export ./src/mpt/io_write bin/dist-autotools/src/mpt/io_write #svn export ./src/mpt/json bin/dist-autotools/src/mpt/json #svn export ./src/mpt/library bin/dist-autotools/src/mpt/library +svn export ./src/mpt/main bin/dist-autotools/src/mpt/main svn export ./src/mpt/mutex bin/dist-autotools/src/mpt/mutex svn export ./src/mpt/out_of_memory bin/dist-autotools/src/mpt/out_of_memory svn export ./src/mpt/osinfo bin/dist-autotools/src/mpt/osinfo @@ -164,6 +165,7 @@ cp -r ./src/mpt/io_write bin/dist-autotools/src/mpt/io_write #cp -r ./src/mpt/json bin/dist-autotools/src/mpt/json #cp -r ./src/mpt/library bin/dist-autotools/src/mpt/library +cp -r ./src/mpt/main bin/dist-autotools/src/mpt/main cp -r ./src/mpt/mutex bin/dist-autotools/src/mpt/mutex cp -r ./src/mpt/out_of_memory bin/dist-autotools/src/mpt/out_of_memory cp -r ./src/mpt/osinfo bin/dist-autotools/src/mpt/osinfo Modified: trunk/OpenMPT/build/premake-xcode/mpt-libopenmpt.lua ============================================================================== --- trunk/OpenMPT/build/premake-xcode/mpt-libopenmpt.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake-xcode/mpt-libopenmpt.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -49,6 +49,8 @@ "../../src/mpt/json/**.hpp", "../../src/mpt/library/**.cpp", "../../src/mpt/library/**.hpp", + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/mpt/test/**.cpp", "../../src/mpt/test/**.hpp", "../../src/mpt/uuid_namespace/**.cpp", Modified: trunk/OpenMPT/build/premake/mpt-OpenMPT-NativeSupport.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-OpenMPT-NativeSupport.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-OpenMPT-NativeSupport.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -35,6 +35,8 @@ } excludes { "../../mptrack/wine/WineWrapper.cpp", + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/openmpt/fileformat_base/**.cpp", "../../src/openmpt/fileformat_base/**.hpp", "../../src/openmpt/soundfile_data/**.cpp", Modified: trunk/OpenMPT/build/premake/mpt-OpenMPT.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-OpenMPT.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-OpenMPT.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -118,6 +118,10 @@ "../../pluginBridge/BridgeWrapper.cpp", "../../pluginBridge/BridgeWrapper.h", } + excludes { + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", + } files { "../../mptrack/mptrack.rc", "../../mptrack/res/*.*", -- resource data files Modified: trunk/OpenMPT/build/premake/mpt-PluginBridge.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-PluginBridge.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-PluginBridge.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -23,6 +23,8 @@ "../../common/versionNumber.h", } excludes { + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/openmpt/fileformat_base/**.cpp", "../../src/openmpt/fileformat_base/**.hpp", "../../src/openmpt/soundbase/**.cpp", @@ -83,6 +85,8 @@ "../../common/versionNumber.h", } excludes { + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/openmpt/fileformat_base/**.cpp", "../../src/openmpt/fileformat_base/**.hpp", "../../src/openmpt/soundbase/**.cpp", Modified: trunk/OpenMPT/build/premake/mpt-libopenmpt-small.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-libopenmpt-small.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-libopenmpt-small.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -66,6 +66,8 @@ "../../src/mpt/json/**.hpp", "../../src/mpt/library/**.cpp", "../../src/mpt/library/**.hpp", + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/mpt/test/**.cpp", "../../src/mpt/test/**.hpp", "../../src/mpt/uuid_namespace/**.cpp", Modified: trunk/OpenMPT/build/premake/mpt-libopenmpt.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-libopenmpt.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-libopenmpt.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -52,6 +52,8 @@ "../../src/mpt/json/**.hpp", "../../src/mpt/library/**.cpp", "../../src/mpt/library/**.hpp", + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/mpt/test/**.cpp", "../../src/mpt/test/**.hpp", "../../src/mpt/uuid_namespace/**.cpp", Modified: trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -78,6 +78,8 @@ "../../src/mpt/json/**.hpp", "../../src/mpt/library/**.cpp", "../../src/mpt/library/**.hpp", + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/mpt/uuid_namespace/**.cpp", "../../src/mpt/uuid_namespace/**.hpp", "../../test/mpt_tests_crypto.cpp", Modified: trunk/OpenMPT/build/premake/mpt-updatesigntool.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-updatesigntool.lua Mon Sep 23 16:25:29 2024 (r21698) +++ trunk/OpenMPT/build/premake/mpt-updatesigntool.lua Mon Sep 23 18:20:59 2024 (r21699) @@ -24,6 +24,8 @@ "../../installer/updatesigntool/*.h", } excludes { + "../../src/mpt/main/**.cpp", + "../../src/mpt/main/**.hpp", "../../src/openmpt/fileformat_base/**.cpp", "../../src/openmpt/fileformat_base/**.hpp", "../../src/openmpt/soundbase/**.cpp", Added: trunk/OpenMPT/src/mpt/main/main.hpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/OpenMPT/src/mpt/main/main.hpp Mon Sep 23 18:20:59 2024 (r21699) @@ -0,0 +1,196 @@ +/* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */ + +#ifndef MPT_MAIN_MAIN_HPP +#define MPT_MAIN_MAIN_HPP + + + +#include "mpt/base/check_platform.hpp" +#include "mpt/base/detect.hpp" +#include "mpt/base/integer.hpp" +#include "mpt/base/macros.hpp" +#include "mpt/base/namespace.hpp" +#include "mpt/string/types.hpp" +#include "mpt/string_transcode/transcode.hpp" + +#include <type_traits> +#include <vector> + +#if MPT_OS_DJGPP +#include <cassert> +#endif // MPT_OS_DJGPP + +#if MPT_OS_DJGPP +#include <crt0.h> +#endif // MPT_OS_DJGPP + +#if MPT_OS_WINDOWS +#include <windows.h> +#endif // MPT_OS_WINDOWS + + + +namespace mpt { +inline namespace MPT_INLINE_NS { + + + +namespace main { + + + +#if MPT_OS_DJGPP +/* Work-around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45977> */ +/* clang-format off */ +#define MPT_MAIN_PREFIX \ + extern "C" { \ + int _crt0_startup_flags = 0 \ + | _CRT0_FLAG_NONMOVE_SBRK /* force interrupt compatible allocation */ \ + | _CRT0_DISABLE_SBRK_ADDRESS_WRAP /* force NT compatible allocation */ \ + | _CRT0_FLAG_LOCK_MEMORY /* lock all code and data at program startup */ \ + | 0; \ + } \ +/* clang-format on */ +#endif /* MPT_OS_DJGPP */ + +#if !defined(MPT_MAIN_PREFIX) +#define MPT_MAIN_PREFIX +#endif + + + +#if MPT_OS_WINDOWS && defined(UNICODE) +#define MPT_MAIN_NAME wmain +#elif defined(MPT_OS_WINDOWS) +#define MPT_MAIN_NAME main +#endif + +#if !defined(MPT_MAIN_NAME) +#define MPT_MAIN_NAME main +#endif + + + +#if MPT_OS_WINDOWS && defined(UNICODE) +#define MPT_MAIN_ARGV_TYPE wchar_t +#elif defined(MPT_OS_WINDOWS) +#define MPT_MAIN_ARGV_TYPE char +#endif + +#if !defined(MPT_MAIN_NAME) +#define MPT_MAIN_ARGV_TYPE char +#endif + + + +#if MPT_OS_WINDOWS && (MPT_COMPILER_GCC || MPT_COMPILER_CLANG) +#if defined(UNICODE) +#define MPT_MAIN_DECL extern "C" int wmain(int argc, wchar_t * argv[]); +#endif +#endif + +#if !defined(MPT_MAIN_DECL) +#define MPT_MAIN_DECL +#endif + + + +#if MPT_OS_DJGPP +/* clang-format off */ +#define MPT_MAIN_PROLOG() \ + do { \ + _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; \ + assert(mpt::platform::libc().is_ok()); \ + } while (0) \ +/**/ +/* clang-format on */ +#endif // MPT_OS_DJGPP + +#if !defined(MPT_MAIN_PROLOG) +#define MPT_MAIN_PROLOG() do { } while(0) +#endif + + + +#if MPT_OS_WINDOWS && (MPT_COMPILER_GCC || MPT_COMPILER_CLANG) +#if defined(UNICODE) +#define MPT_MAIN_DEF_PREFIX extern "C" +#endif +#endif // MPT_OS_WINDOWS && (MPT_COMPILER_GCC || MPT_COMPILER_CLANG) + +#if !defined(MPT_MAIN_DEF_PREFIX) +#define MPT_MAIN_DEF_PREFIX +#endif + + + +inline mpt::ustring transcode_arg(char * arg) { + return mpt::transcode<mpt::ustring>(mpt::logical_encoding::locale, arg); +} + +#if !defined(MPT_COMPILER_QUIRK_NO_WCHAR) +inline mpt::ustring transcode_arg(wchar_t * arg) { + return mpt::transcode<mpt::ustring>(arg); +} +#endif + +template <typename Tchar> +inline std::vector<mpt::ustring> transcode_argv(int argc, Tchar * argv[]) { + std::vector<mpt::ustring> args; + args.reserve(argc); + for (int arg = 0; arg < argc; ++arg) { + args.push_back(transcode_arg(argv[arg])); + } + return args; +} + + + +#if !defined(MPT_MAIN_POSTFIX) +#define MPT_MAIN_POSTFIX +#endif + + + +/* clang-format off */ +#define MPT_MAIN_IMPLEMENT_MAIN(ns) \ + MPT_MAIN_PREFIX \ + MPT_MAIN_DECL \ + MPT_MAIN_DEF_PREFIX int MPT_MAIN_NAME(int argc, MPT_MAIN_ARGV_TYPE * argv[]) { \ + MPT_MAIN_PROLOG(); \ + static_assert(std::is_same<decltype(ns::main), mpt::uint8(std::vector<mpt::ustring>)>::value); \ + return static_cast<int>(ns::main(mpt::main::transcode_argv(argc, argv))); \ + } \ + MPT_MAIN_POSTFIX \ +/**/ +/* clang-format on */ + + + +/* clang-format off */ +#define MPT_MAIN_IMPLEMENT_MAIN_NO_ARGS(ns) \ + MPT_MAIN_PREFIX \ + MPT_MAIN_DECL \ + MPT_MAIN_DEF_PREFIX int MPT_MAIN_NAME(int argc, MPT_MAIN_ARGV_TYPE * argv[]) { \ + MPT_MAIN_PROLOG(); \ + static_assert(std::is_same<decltype(ns::main), mpt::uint8(void); \ + MPT_UNUSED(argc); \ + MPT_UNUSED(argv); \ + return static_cast<int>(ns::main()); \ + } \ + MPT_MAIN_POSTFIX \ +/**/ +/* clang-format on */ + + + +} // namespace main + + + +} // namespace MPT_INLINE_NS +} // namespace mpt + + + +#endif // MPT_MAIN_MAIN_HPP |
From: <sv...@op...> - 2024-09-23 14:25:37
|
Author: manx Date: Mon Sep 23 16:25:29 2024 New Revision: 21698 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21698 Log: Merged revision(s) 21696 from trunk/OpenMPT: [Fix] mpt/base/math.hpp: Fix header guard name. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/src/mpt/base/math.hpp Modified: branches/OpenMPT-1.30/src/mpt/base/math.hpp ============================================================================== --- branches/OpenMPT-1.30/src/mpt/base/math.hpp Mon Sep 23 16:25:05 2024 (r21697) +++ branches/OpenMPT-1.30/src/mpt/base/math.hpp Mon Sep 23 16:25:29 2024 (r21698) @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */ -#ifndef MPT_BASE_EMPTY_HPP -#define MPT_BASE_EMPTY_HPP +#ifndef MPT_BASE_MATH_HPP +#define MPT_BASE_MATH_HPP @@ -85,4 +85,4 @@ -#endif // MPT_BASE_EMPTY_HPP +#endif // MPT_BASE_MATH_HPP |
From: <sv...@op...> - 2024-09-23 14:25:17
|
Author: manx Date: Mon Sep 23 16:25:05 2024 New Revision: 21697 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21697 Log: Merged revision(s) 21696 from trunk/OpenMPT: [Fix] mpt/base/math.hpp: Fix header guard name. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/src/mpt/base/math.hpp Modified: branches/OpenMPT-1.31/src/mpt/base/math.hpp ============================================================================== --- branches/OpenMPT-1.31/src/mpt/base/math.hpp Mon Sep 23 16:24:34 2024 (r21696) +++ branches/OpenMPT-1.31/src/mpt/base/math.hpp Mon Sep 23 16:25:05 2024 (r21697) @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */ -#ifndef MPT_BASE_EMPTY_HPP -#define MPT_BASE_EMPTY_HPP +#ifndef MPT_BASE_MATH_HPP +#define MPT_BASE_MATH_HPP @@ -85,4 +85,4 @@ -#endif // MPT_BASE_EMPTY_HPP +#endif // MPT_BASE_MATH_HPP |
From: <sv...@op...> - 2024-09-23 14:24:45
|
Author: manx Date: Mon Sep 23 16:24:34 2024 New Revision: 21696 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21696 Log: [Fix] mpt/base/math.hpp: Fix header guard name. Modified: trunk/OpenMPT/src/mpt/base/math.hpp Modified: trunk/OpenMPT/src/mpt/base/math.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/base/math.hpp Mon Sep 23 15:50:59 2024 (r21695) +++ trunk/OpenMPT/src/mpt/base/math.hpp Mon Sep 23 16:24:34 2024 (r21696) @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */ -#ifndef MPT_BASE_EMPTY_HPP -#define MPT_BASE_EMPTY_HPP +#ifndef MPT_BASE_MATH_HPP +#define MPT_BASE_MATH_HPP @@ -85,4 +85,4 @@ -#endif // MPT_BASE_EMPTY_HPP +#endif // MPT_BASE_MATH_HPP |
From: <sv...@op...> - 2024-09-23 13:51:11
|
Author: manx Date: Mon Sep 23 15:50:59 2024 New Revision: 21695 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21695 Log: [Ref] openmpt123: Factor out stdio handling for different modes and platforms. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 15:49:57 2024 (r21694) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 15:50:59 2024 (r21695) @@ -2160,7 +2160,6 @@ return; } tcgetattr( STDIN_FILENO, &saved_attributes ); - atexit( reset_input_mode ); tcgetattr( STDIN_FILENO, &tattr ); tattr.c_lflag &= ~( ICANON | ECHO ); tattr.c_cc[VMIN] = 1; |
From: <sv...@op...> - 2024-09-23 13:50:10
|
Author: manx Date: Mon Sep 23 15:49:57 2024 New Revision: 21694 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21694 Log: [Ref] openmpt123: Factor out stdio handling for different modes and platforms. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 15:24:20 2024 (r21693) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 15:49:57 2024 (r21694) @@ -153,30 +153,6 @@ constexpr auto libopenmpt_encoding = mpt::common_encoding::utf8; -#if !MPT_OS_WINDOWS - -static termios saved_attributes; - -static void reset_input_mode() { - tcsetattr( STDIN_FILENO, TCSANOW, &saved_attributes ); -} - -static void set_input_mode() { - termios tattr; - if ( !isatty( STDIN_FILENO ) ) { - return; - } - tcgetattr( STDIN_FILENO, &saved_attributes ); - atexit( reset_input_mode ); - tcgetattr( STDIN_FILENO, &tattr ); - tattr.c_lflag &= ~( ICANON | ECHO ); - tattr.c_cc[VMIN] = 1; - tattr.c_cc[VTIME] = 0; - tcsetattr( STDIN_FILENO, TCSAFLUSH, &tattr ); -} - -#endif - class file_audio_stream_raii : public file_audio_stream_base { private: std::unique_ptr<file_audio_stream_base> impl; @@ -2102,31 +2078,48 @@ } +enum class FILE_mode { + unchanged, + utf8, + binary, +}; + #if MPT_OS_WINDOWS -class FD_utf8_raii { +class FILE_mode_guard { private: FILE * file; int old_mode; public: - FD_utf8_raii( FILE * file, bool set_utf8 ) + FILE_mode_guard( FILE * file, FILE_mode new_mode ) : file(file) , old_mode(-1) { - if ( set_utf8 ) { - fflush( file ); - #if defined(UNICODE) - old_mode = _setmode( _fileno( file ), _O_U8TEXT ); - #else - old_mode = _setmode( _fileno( file ), _O_TEXT ); - #endif - if ( old_mode == -1 ) { - throw exception( MPT_USTRING("failed to set TEXT mode on file descriptor") ); - } + switch (new_mode) { + case FILE_mode::utf8: + fflush( file ); + #if defined(UNICODE) + old_mode = _setmode( _fileno( file ), _O_U8TEXT ); + #else + old_mode = _setmode( _fileno( file ), _O_TEXT ); + #endif + if ( old_mode == -1 ) { + throw exception( MPT_USTRING("failed to set TEXT mode on file descriptor") ); + } + break; + case FILE_mode::binary: + fflush( file ); + old_mode = _setmode( _fileno( file ), _O_BINARY ); + if ( old_mode == -1 ) { + throw exception( MPT_USTRING("failed to set binary mode on file descriptor") ); + } + break; + default: + // nothing + break; } } - ~FD_utf8_raii() - { + ~FILE_mode_guard() { if ( old_mode != -1 ) { fflush( file ); old_mode = _setmode( _fileno( file ), old_mode ); @@ -2134,28 +2127,50 @@ } }; -class FD_binary_raii { -private: - FILE * file; - int old_mode; +class terminal_input_guard { public: - FD_binary_raii( FILE * file, bool set_binary ) - : file(file) - , old_mode(-1) - { - if ( set_binary ) { - fflush( file ); - old_mode = _setmode( _fileno( file ), _O_BINARY ); - if ( old_mode == -1 ) { - throw exception( MPT_USTRING("failed to set binary mode on file descriptor") ); - } - } + terminal_input_guard( bool /* enable */ ) { + return; } - ~FD_binary_raii() + ~terminal_input_guard() = default; +}; + +#else + +class FILE_mode_guard { +public: + FILE_mode_guard( FILE * /* file */, FILE_mode /* new_mode */ ) { - if ( old_mode != -1 ) { - fflush( file ); - old_mode = _setmode( _fileno( file ), old_mode ); + return; + } + ~FILE_mode_guard() = default; +}; + +class terminal_input_guard { +private: + bool changed = false; + termios saved_attributes; +public: + terminal_input_guard( bool enable ) { + if ( !enable ) { + return; + } + termios tattr; + if ( !isatty( STDIN_FILENO ) ) { + return; + } + tcgetattr( STDIN_FILENO, &saved_attributes ); + atexit( reset_input_mode ); + tcgetattr( STDIN_FILENO, &tattr ); + tattr.c_lflag &= ~( ICANON | ECHO ); + tattr.c_cc[VMIN] = 1; + tattr.c_cc[VTIME] = 0; + tcsetattr( STDIN_FILENO, TCSAFLUSH, &tattr ); + changed = true; + } + ~terminal_input_guard() { + if ( changed ) { + tcsetattr(STDIN_FILENO, TCSANOW, &saved_attributes); } } }; @@ -2194,11 +2209,9 @@ } #endif -#if MPT_OS_WINDOWS - FD_utf8_raii stdin_utf8_guard( stdin, true ); - FD_utf8_raii stdout_utf8_guard( stdout, true ); - FD_utf8_raii stderr_utf8_guard( stderr, true ); -#endif + FILE_mode_guard stdin_utf8_guard( stdin, FILE_mode::utf8 ); + FILE_mode_guard stdout_utf8_guard( stdout, FILE_mode::utf8 ); + FILE_mode_guard stderr_utf8_guard( stderr, FILE_mode::utf8 ); textout_dummy dummy_log; #if MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) #if defined(UNICODE) @@ -2304,23 +2317,13 @@ } // set stdin binary -#if MPT_OS_WINDOWS - FD_binary_raii stdin_guard( stdin, !stdin_can_ui ); -#endif + FILE_mode_guard stdin_guard( stdin, stdin_can_ui ? FILE_mode::unchanged : FILE_mode::binary ); // set stdout binary -#if MPT_OS_WINDOWS - FD_binary_raii stdout_guard( stdout, !stdout_can_ui ); -#endif + FILE_mode_guard stdout_guard( stdout, stdout_can_ui ? FILE_mode::unchanged : FILE_mode::binary ); // setup terminal - #if !MPT_OS_WINDOWS - if ( stdin_can_ui ) { - if ( flags.mode == Mode::UI ) { - set_input_mode(); - } - } - #endif + terminal_input_guard input_guard( stdin_can_ui && ( flags.mode == Mode::UI ) ); textout & log = flags.quiet ? static_cast<textout&>( dummy_log ) : static_cast<textout&>( stdout_can_ui ? std_out : std_err ); |
From: <sv...@op...> - 2024-09-23 13:24:32
|
Author: sagamusix Date: Mon Sep 23 15:24:20 2024 New Revision: 21693 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21693 Log: Merged revision(s) 21689, 21692 from trunk/OpenMPT: [Fix] Prevent "Close All" keyboard shortcut from being activated when a dialog is open. It wasn't able to close the files anyway (due to using SafeFileClose call), but it reset the modified status of open files. [Fix] "Close All" menu item didn't show associated keyboard shortcut. [Mod] Make toolbar toggling menu entry titles more obvious, and show available keyboard shortcuts when opening via context menu. [Ref] Unify implementations for toolbar toggling menu. ........ [Ref] DMF: Document different possible header value for tracker ID. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/mptrack/InputHandler.cpp branches/OpenMPT-1.31/mptrack/MainFrm.cpp branches/OpenMPT-1.31/mptrack/Mainfrm.h branches/OpenMPT-1.31/mptrack/mptrack.rc branches/OpenMPT-1.31/mptrack/resource.h branches/OpenMPT-1.31/soundlib/Load_dmf.cpp Modified: branches/OpenMPT-1.31/mptrack/InputHandler.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/InputHandler.cpp Mon Sep 23 15:22:44 2024 (r21692) +++ branches/OpenMPT-1.31/mptrack/InputHandler.cpp Mon Sep 23 15:24:20 2024 (r21693) @@ -488,8 +488,8 @@ { ID_VIEW_INSTRUMENTS, kcViewInstruments, _T("&Instruments") }, { ID_VIEW_COMMENTS, kcViewComments, _T("&Comments") }, { ID_VIEW_OPTIONS, kcViewOptions, _T("S&etup") }, - { ID_VIEW_TOOLBAR, kcViewMain, _T("&Main") }, - { IDD_TREEVIEW, kcViewTree, _T("&Tree") }, + { ID_VIEW_TOOLBAR, kcViewMain, _T("Show &Main Toolbar") }, + { IDD_TREEVIEW, kcViewTree, _T("Show &Tree View") }, { ID_PLUGIN_SETUP, kcViewAddPlugin, _T("Pl&ugin Manager") }, { ID_CHANNEL_MANAGER, kcViewChannelManager, _T("Ch&annel Manager") }, { ID_CLIPBOARD_MANAGER, kcToggleClipboardManager, _T("C&lipboard Manager") }, @@ -528,6 +528,7 @@ ID_FILE_OPEN, ID_FILE_APPENDMODULE, ID_FILE_CLOSE, + ID_FILE_CLOSEALL, ID_FILE_SAVE, ID_FILE_SAVE_AS, ID_FILE_SAVEASWAVE, Modified: branches/OpenMPT-1.31/mptrack/MainFrm.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/MainFrm.cpp Mon Sep 23 15:22:44 2024 (r21692) +++ branches/OpenMPT-1.31/mptrack/MainFrm.cpp Mon Sep 23 15:24:20 2024 (r21693) @@ -541,24 +541,17 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { + // Right-click menu to disable/enable tree view and main toolbar when right-clicking on either the menu strip or main toolbar if((pMsg->message == WM_RBUTTONDOWN) || (pMsg->message == WM_NCRBUTTONDOWN)) { - CWnd* pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); - CControlBar* pBar = NULL; - HWND hwnd = (pWnd) ? pWnd->m_hWnd : NULL; - - if ((hwnd) && (pMsg->message == WM_RBUTTONDOWN)) pBar = DYNAMIC_DOWNCAST(CControlBar, pWnd); - if ((pBar != NULL) || ((pMsg->message == WM_NCRBUTTONDOWN) && (pMsg->wParam == HTMENU))) + CControlBar *pBar = nullptr; + if(CWnd *pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); pWnd && (pMsg->message == WM_RBUTTONDOWN)) + pBar = dynamic_cast<CControlBar *>(pWnd); + if(pBar != nullptr || (pMsg->message == WM_NCRBUTTONDOWN && pMsg->wParam == HTMENU)) { - CMenu Menu; CPoint pt; - GetCursorPos(&pt); - if (Menu.LoadMenu(IDR_TOOLBARS)) - { - CMenu* pSubMenu = Menu.GetSubMenu(0); - if (pSubMenu!=NULL) pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,this); - } + ShowToolbarMenu(pt); } } return CMDIFrameWnd::PreTranslateMessage(pMsg); @@ -2430,13 +2423,19 @@ void CMainFrame::OnRButtonDown(UINT, CPoint pt) { - CMenu Menu; ClientToScreen(&pt); - if (Menu.LoadMenu(IDR_TOOLBARS)) - { - CMenu *pSubMenu = Menu.GetSubMenu(0); - if (pSubMenu != nullptr) pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, this); - } + ShowToolbarMenu(pt); +} + + +void CMainFrame::ShowToolbarMenu(CPoint screenPt) +{ + CMenu menu; + if(!menu.CreatePopupMenu()) + return; + menu.AppendMenu(MF_STRING, ID_VIEW_TOOLBAR, m_InputHandler->GetMenuText(ID_VIEW_TOOLBAR)); + menu.AppendMenu(MF_STRING, IDD_TREEVIEW, m_InputHandler->GetMenuText(IDD_TREEVIEW)); + menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, screenPt.x, screenPt.y, this); } @@ -2447,19 +2446,23 @@ case kcViewTree: OnBarCheck(IDD_TREEVIEW); break; case kcViewOptions: OnViewOptions(); break; case kcViewMain: OnBarCheck(ID_VIEW_TOOLBAR); break; - case kcFileImportMidiLib: OnImportMidiLib(); break; + case kcFileImportMidiLib: OnImportMidiLib(); break; case kcFileAddSoundBank: OnAddDlsBank(); break; - case kcPauseSong: OnPlayerPause(); break; - case kcPrevOctave: OnPrevOctave(); break; - case kcNextOctave: OnNextOctave(); break; - case kcFileNew: theApp.OnFileNew(); break; - case kcFileOpen: theApp.OnFileOpen(); break; - case kcMidiRecord: OnMidiRecord(); break; - case kcHelp: OnHelp(); break; + case kcPauseSong: OnPlayerPause(); break; + case kcPrevOctave: OnPrevOctave(); break; + case kcNextOctave: OnNextOctave(); break; + case kcFileNew: theApp.OnFileNew(); break; + case kcFileOpen: theApp.OnFileOpen(); break; + case kcMidiRecord: OnMidiRecord(); break; + case kcHelp: OnHelp(); break; case kcViewAddPlugin: OnPluginManager(); break; - case kcNextDocument: MDINext(); break; - case kcPrevDocument: MDIPrev(); break; - case kcFileCloseAll: theApp.OnFileCloseAll(); break; + case kcNextDocument: MDINext(); break; + case kcPrevDocument: MDIPrev(); break; + case kcFileCloseAll: + if(GetActiveWindow() != this) + return kcNull; + theApp.OnFileCloseAll(); + break; //D'oh!! moddoc isn't a CWnd so we have to handle its messages and pass them on. Modified: branches/OpenMPT-1.31/mptrack/Mainfrm.h ============================================================================== --- branches/OpenMPT-1.31/mptrack/Mainfrm.h Mon Sep 23 15:22:44 2024 (r21692) +++ branches/OpenMPT-1.31/mptrack/Mainfrm.h Mon Sep 23 15:24:20 2024 (r21693) @@ -493,6 +493,8 @@ /// Opens either template or example menu item. void OpenMenuItemFile(const UINT nId, const bool isTemplateFile); + void ShowToolbarMenu(CPoint screenPt); + public: void UpdateMRUList(); Modified: branches/OpenMPT-1.31/mptrack/mptrack.rc ============================================================================== --- branches/OpenMPT-1.31/mptrack/mptrack.rc Mon Sep 23 15:22:44 2024 (r21692) +++ branches/OpenMPT-1.31/mptrack/mptrack.rc Mon Sep 23 15:24:20 2024 (r21693) @@ -2870,15 +2870,6 @@ END END -IDR_TOOLBARS MENU -BEGIN - POPUP "&ToolBars" - BEGIN - MENUITEM "&Main", ID_VIEW_TOOLBAR - MENUITEM "&Tree", IDD_TREEVIEW - END -END - IDR_ENVELOPES MENU BEGIN POPUP "&Envelope" Modified: branches/OpenMPT-1.31/mptrack/resource.h ============================================================================== --- branches/OpenMPT-1.31/mptrack/resource.h Mon Sep 23 15:22:44 2024 (r21692) +++ branches/OpenMPT-1.31/mptrack/resource.h Mon Sep 23 15:24:20 2024 (r21693) @@ -31,7 +31,6 @@ #define IDD_OPTIONS_EFFECTS 133 #define IDR_MAINFRAME 200 #define IDR_MODULETYPE 201 -#define IDR_TOOLBARS 202 #define ID_PATTERN_CHANNELMANAGER 202 #define IDR_ENVELOPES 203 #define ID_INDICATOR_CPU 203 Modified: branches/OpenMPT-1.31/soundlib/Load_dmf.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_dmf.cpp Mon Sep 23 15:22:44 2024 (r21692) +++ branches/OpenMPT-1.31/soundlib/Load_dmf.cpp Mon Sep 23 15:24:20 2024 (r21693) @@ -24,7 +24,7 @@ { char signature[4]; // "DDMF" uint8 version; // 1 - 7 are beta versions, 8 is the official thing, 10 is xtracker32 - char tracker[8]; // "XTRACKER" + char tracker[8]; // "XTRACKER", or "SCREAM 3" when converting from S3M, etc. char songname[30]; char composer[20]; uint8 creationDay; |
From: <sv...@op...> - 2024-09-23 13:22:51
|
Author: sagamusix Date: Mon Sep 23 15:22:44 2024 New Revision: 21692 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21692 Log: [Ref] DMF: Document different possible header value for tracker ID. Modified: trunk/OpenMPT/soundlib/Load_dmf.cpp Modified: trunk/OpenMPT/soundlib/Load_dmf.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_dmf.cpp Mon Sep 23 15:20:13 2024 (r21691) +++ trunk/OpenMPT/soundlib/Load_dmf.cpp Mon Sep 23 15:22:44 2024 (r21692) @@ -24,7 +24,7 @@ { char signature[4]; // "DDMF" uint8 version; // 1 - 7 are beta versions, 8 is the official thing, 10 is xtracker32 - char tracker[8]; // "XTRACKER" + char tracker[8]; // "XTRACKER", or "SCREAM 3" when converting from S3M, etc. char songname[30]; char composer[20]; uint8 creationDay; |