@@ -46,12 +46,29 @@ private UopPackerControl()
4646 outfolder . PlaceholderText = "folder where .mul/.idx will be written" ;
4747 outuopfolder . PlaceholderText = "folder where .uop will be written" ;
4848
49+ packAllGumpCompressionBox . SelectedIndex = 0 ;
50+ extract . CheckedChanged += OnPackAllModeChanged ;
51+ pack . CheckedChanged += OnPackAllModeChanged ;
52+ UpdatePackAllCompressionVisibility ( ) ;
53+
4954 RefreshMulTypeUi ( ) ;
5055 RefreshUopTypeUi ( ) ;
5156
5257 Dock = DockStyle . Fill ;
5358 }
5459
60+ private void OnPackAllModeChanged ( object sender , EventArgs e ) => UpdatePackAllCompressionVisibility ( ) ;
61+
62+ private void UpdatePackAllCompressionVisibility ( )
63+ {
64+ bool show = pack . Checked ;
65+ packAllGumpCompressionLabel . Visible = show ;
66+ packAllGumpCompressionBox . Visible = show ;
67+ packAllHousingBinLabel . Visible = show ;
68+ packAllHousingBin . Visible = show ;
69+ packAllHousingBinBtn . Visible = show ;
70+ }
71+
5572 private static ( string mul , string idx , string uop ) GetConventionalNames ( FileType type , int mapIndex )
5673 {
5774 return type switch
@@ -384,6 +401,25 @@ private void SelectFolder_Click(object sender, EventArgs e)
384401 if ( FolderDialog . ShowDialog ( ) == DialogResult . OK )
385402 {
386403 inputfolder . Text = FolderDialog . SelectedPath ;
404+
405+ if ( string . IsNullOrWhiteSpace ( packAllHousingBin . Text ) )
406+ {
407+ string candidate = Path . Combine ( FolderDialog . SelectedPath , "housing.bin" ) ;
408+ if ( File . Exists ( candidate ) )
409+ {
410+ packAllHousingBin . Text = candidate ;
411+ }
412+ }
413+ }
414+ }
415+
416+ private void PackAllHousingBinSelect ( object sender , EventArgs e )
417+ {
418+ FileDialog . FilterIndex = 4 ;
419+
420+ if ( FileDialog . ShowDialog ( ) == DialogResult . OK )
421+ {
422+ packAllHousingBin . Text = FileDialog . FileName ;
387423 }
388424 }
389425
@@ -436,7 +472,7 @@ private void Extract(string inFile, string outFile, string outIdx, FileType type
436472 }
437473 }
438474
439- private void Pack ( string inFile , string inIdx , string outFile , FileType type , int typeIndex , string housingBinFile = "" )
475+ private void Pack ( string inFile , string inIdx , string outFile , FileType type , int typeIndex , CompressionFlag compression , string housingBinFile = "" )
440476 {
441477 try
442478 {
@@ -466,9 +502,8 @@ private void Pack(string inFile, string inIdx, string outFile, FileType type, in
466502 }
467503
468504 ++ _total ;
469- CompressionFlag selectedCompressionMethod = Enum . Parse < CompressionFlag > ( compressionBox . SelectedItem . ToString ( ) ) ;
470505
471- LegacyMulFileConverter . ToUop ( inFile , inIdx , outFile , type , typeIndex , selectedCompressionMethod , housingBinFile ?? string . Empty ) ;
506+ LegacyMulFileConverter . ToUop ( inFile , inIdx , outFile , type , typeIndex , compression , housingBinFile ?? string . Empty ) ;
472507
473508 ++ _success ;
474509 }
@@ -523,19 +558,41 @@ private void StartFolderButtonClick(object sender, EventArgs e)
523558 }
524559 else if ( pack . Checked )
525560 {
561+ CompressionFlag gumpCompression = CompressionFlag . None ;
562+ if ( packAllGumpCompressionBox . SelectedItem != null )
563+ {
564+ Enum . TryParse ( packAllGumpCompressionBox . SelectedItem . ToString ( ) , out gumpCompression ) ;
565+ }
566+
567+ string housingBinPath = string . IsNullOrWhiteSpace ( packAllHousingBin . Text )
568+ ? "housing.bin"
569+ : packAllHousingBin . Text ;
570+
571+ if ( ! string . IsNullOrWhiteSpace ( packAllHousingBin . Text ) )
572+ {
573+ string resolved = Path . IsPathRooted ( housingBinPath )
574+ ? housingBinPath
575+ : Path . Combine ( inputfolder . Text , housingBinPath ) ;
576+ if ( ! File . Exists ( resolved ) )
577+ {
578+ MessageBox . Show ( $ "The specified housing.bin does not exist:\r \n { resolved } ") ;
579+ return ;
580+ }
581+ }
582+
526583 _success = _total = 0 ;
527584
528- Pack ( "art.mul" , "artidx.mul" , "artLegacyMUL.uop" , FileType . ArtLegacyMul , 0 ) ;
529- Pack ( "gumpart.mul" , "gumpidx.mul" , "gumpartLegacyMUL.uop" , FileType . GumpartLegacyMul , 0 ) ;
530- Pack ( "sound.mul" , "soundidx.mul" , "soundLegacyMUL.uop" , FileType . SoundLegacyMul , 0 ) ;
531- Pack ( "multi-unpacked.mul" , "multi-unpacked.idx" , "MultiCollection.uop" , FileType . MultiCollection , 0 , "housing.bin" ) ;
585+ Pack ( "art.mul" , "artidx.mul" , "artLegacyMUL.uop" , FileType . ArtLegacyMul , 0 , CompressionFlag . None ) ;
586+ Pack ( "gumpart.mul" , "gumpidx.mul" , "gumpartLegacyMUL.uop" , FileType . GumpartLegacyMul , 0 , gumpCompression ) ;
587+ Pack ( "sound.mul" , "soundidx.mul" , "soundLegacyMUL.uop" , FileType . SoundLegacyMul , 0 , CompressionFlag . None ) ;
588+ Pack ( "multi-unpacked.mul" , "multi-unpacked.idx" , "MultiCollection.uop" , FileType . MultiCollection , 0 , CompressionFlag . Zlib , housingBinPath ) ;
532589
533590 for ( int i = 0 ; i <= 5 ; ++ i )
534591 {
535592 string map = $ "map{ i } ";
536593
537- Pack ( map + ".mul" , null , map + "LegacyMUL.uop" , FileType . MapLegacyMul , i ) ;
538- Pack ( map + "x.mul" , null , map + "xLegacyMUL.uop" , FileType . MapLegacyMul , i ) ;
594+ Pack ( map + ".mul" , null , map + "LegacyMUL.uop" , FileType . MapLegacyMul , i , CompressionFlag . None ) ;
595+ Pack ( map + "x.mul" , null , map + "xLegacyMUL.uop" , FileType . MapLegacyMul , i , CompressionFlag . None ) ;
539596 }
540597
541598 string packMessage = $ "Done ({ _success } /{ _total } files packed)";
0 commit comments