1 # ======================================================================
2 # printCustomizationVariables.pl
4 # Tool to print customization variables from a variety of different sources.
5 # ======================================================================
9 # ======================================================================
13 # ======================================================================
19 print "\t$0 -1 <sql dump 1-liner format>\n";
22 print "\t-h: print this help.\n";
23 print "\t-1: Oracle SELECT DUMP output for tangible_object.appearance_data\n";
24 print "\t where all data for a single appearance is concatenated to be\n";
25 print "\t on the same line.\n";
28 # ----------------------------------------------------------------------
36 while ((@_ > 0) && ($_[0] =~ s/^-//))
43 $dumpFileName = $_[0] if (defined($_[0]) && (length($_[0]) > 0));
52 print "unrecognized option [$_[0]].\n";
60 # Ensure we're doing something.
61 if (!defined($dumpFileName))
67 # Print help if requested.
68 printUsage
if $printUsage;
74 # ----------------------------------------------------------------------
76 sub convertOracleDumpToString
78 my $oracleDumpString = shift;
82 $oracleDumpString =~ s/^\s*(\d+)?.*:\s*//;
88 if (defined($objectId))
90 print $objectId . "\n";
99 while (length($oracleDumpString) > 0)
101 if ($oracleDumpString =~ s/^(\d+)(\s*,\s*)?//)
103 $newString .= chr($1);
107 print STDERR
"convertOracleDumpToString: ", length($oracleDumpString), " characters remain: [$oracleDumpString].\n";
115 # ----------------------------------------------------------------------
117 sub printCustomizationVariables
119 # Find where p4 maps the customization_id_manager.mif file.
120 # Assume current branch for now.
122 my $branch = $ENV{BRANCH
} || 'current';
123 my $depotFile = '//depot/swg/current/dsrc/sku.0/sys.shared/compiled/game/customization/customization_id_manager.mif';
124 my $output = `p4 where //depot/swg/$branch/dsrc/sku.0/sys.shared/compiled/game/customization/customization_id_manager.mif`;
127 if (defined($output))
129 my @whereParts = split(/\s+/, $output);
130 if (@whereParts == 3)
132 $mifFileName = $whereParts[2];
136 if (!defined(mifFileName
))
138 print STDERR
"Warning: p4 where did not return a 3-part response, defaulting mif file location.\n";
139 $mifFileName = 'd:/work/swg/current/sku.0/sys.shared/compiled/game/customization/customization_id_manager.mif';
142 Customization
::initializeCustomization
($mifFileName);
144 # For each line in 1-line dump file, print out variable data.
146 open($dumpFile, '< ' . $dumpFileName) or die "failed to open dump file [$dumpFileName]: $!";
153 my $encodedString = convertOracleDumpToString
($_);
155 # Convert encoded string into
156 my %variableInfoHash;
157 my $result = Customization
::getVariableInfoFromNewString
(%variableInfoHash, $encodedString);
160 print "entry $entry: failed to convert, format invalid, skipping.\n";
164 Customization
::dumpVariableInfo
(%variableInfoHash);
172 # ----------------------------------------------------------------------
174 # ----------------------------------------------------------------------
176 # Collect info from args.
179 # Print the customization data.
180 printCustomizationVariables
() if defined($dumpFileName);