33#include " zenkit/vobs/Camera.hh"
44
55#include < zenkit/Archive.hh>
6+ #include < zenkit/Logger.hh>
67#include < zenkit/SaveGame.hh>
78#include < zenkit/World.hh>
8- #include < zenkit/Logger.hh>
99
1010#include < iostream>
1111
1212void print_usage () {
1313 std::cerr << " Usage: zen2zen [-f FORMAT] [-i VERSION_INPUT] [-o VERSION_OUTPUT] INPUT OUTPUT\n\n "
14- << " Converts ZenGin archives from and to different formats.\n\n "
15- << " Options:\n "
16- << " \t -f FORMAT \t\t Set the output file format (default: ascii)\n "
17- << " \t -i,--version-in VERSION_INPUT \t\t Set the game version the archive is from (default: gothic1)\n "
18- << " \t -o,--version-out VERSION_OUTPUT\t\t Set the game version the archive should be converted to (default: gothic1)\n\n "
19- << " Possible values:\n "
20- << " \t FORMAT \t\t ascii, binary, binsafe\n "
21- << " \t VERSION_INPUT \t\t 1, g1, gothic1, 2, g2, gothic2\n "
22- << " \t VERSION_OUTPUT\t\t 1, g1, gothic1, 2, g2, gothic2\n " ;
14+ << " Converts ZenGin archives from and to different formats.\n\n "
15+ << " Options:\n "
16+ << " \t -f FORMAT \t\t Set the output file format (default: ascii)\n "
17+ << " \t -i,--version-in VERSION_INPUT \t\t Set the game version the archive is from (default: gothic1)\n "
18+ << " \t -o,--version-out VERSION_OUTPUT\t\t Set the game version the archive should be converted to "
19+ " (default: gothic1)\n\n "
20+ << " Possible values:\n "
21+ << " \t FORMAT \t\t ascii, binary, binsafe\n "
22+ << " \t VERSION_INPUT \t\t 1, g1, gothic1, 2, g2, gothic2\n "
23+ << " \t VERSION_OUTPUT\t\t 1, g1, gothic1, 2, g2, gothic2\n " ;
2324}
2425
25-
2626int main (int argc, char const ** argv) {
2727 if (argc < 3 ) {
2828 print_usage ();
@@ -58,25 +58,34 @@ int main(int argc, char const** argv) {
5858
5959 std::string_view arg = argv[++i];
6060 if (name == " -f" || name == " --format" ) {
61- if (arg == " ascii" ) fmt = zenkit::ArchiveFormat::ASCII;
62- else if (arg == " binary" ) fmt = zenkit::ArchiveFormat::BINARY;
63- else if (arg == " binsafe" ) fmt = zenkit::ArchiveFormat::BINSAFE;
61+ if (arg == " ascii" )
62+ fmt = zenkit::ArchiveFormat::ASCII;
63+ else if (arg == " binary" )
64+ fmt = zenkit::ArchiveFormat::BINARY;
65+ else if (arg == " binsafe" )
66+ fmt = zenkit::ArchiveFormat::BINSAFE;
6467 else {
6568 std::cerr << " Expected one of 'ascii' (default), 'binary' or 'binsafe' as a format\n " ;
6669 return 1 ;
6770 }
6871 } else if (name == " -i" || name == " --version-in" ) {
69- if (arg == " 1" || arg == " g1" || arg == " gothic1" ) ver_input = zenkit::GameVersion::GOTHIC_1;
70- else if (arg == " 2" || arg == " g2" || arg == " gothic2" ) ver_input = zenkit::GameVersion::GOTHIC_2;
72+ if (arg == " 1" || arg == " g1" || arg == " gothic1" )
73+ ver_input = zenkit::GameVersion::GOTHIC_1;
74+ else if (arg == " 2" || arg == " g2" || arg == " gothic2" )
75+ ver_input = zenkit::GameVersion::GOTHIC_2;
7176 else {
72- std::cerr << " Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an input version\n " ;
77+ std::cerr << " Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an input "
78+ " version\n " ;
7379 return 1 ;
7480 }
7581 } else if (name == " -o" || name == " --version-out" ) {
76- if (arg == " 1" || arg == " g1" || arg == " gothic1" ) ver_output = zenkit::GameVersion::GOTHIC_1;
77- else if (arg == " 2" || arg == " g2" || arg == " gothic2" ) ver_output = zenkit::GameVersion::GOTHIC_2;
82+ if (arg == " 1" || arg == " g1" || arg == " gothic1" )
83+ ver_output = zenkit::GameVersion::GOTHIC_1;
84+ else if (arg == " 2" || arg == " g2" || arg == " gothic2" )
85+ ver_output = zenkit::GameVersion::GOTHIC_2;
7886 else {
79- std::cerr << " Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an output version\n " ;
87+ std::cerr << " Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an output "
88+ " version\n " ;
8089 return 1 ;
8190 }
8291 } else {
@@ -93,10 +102,10 @@ int main(int argc, char const** argv) {
93102 auto a_out = zenkit::Write::to (positional[1 ]);
94103 auto a_ar_o = zenkit::WriteArchive::to (a_out.get (), fmt);
95104 a_ar_o->write_object (a, ver_output);
96- } catch (const std::exception& e) {
105+ } catch (std::exception const & e) {
97106 std::cerr << " Error during conversion: " << e.what () << " \n " ;
98107 return -1 ;
99108 }
100109
101- return 0 ;
110+ return 0 ;
102111}
0 commit comments