Sim City 4 Devotion Forums

Sim City 4 Devotion Tools => Tools - General Discussion => null45's Tools => Topic started by: null45 on June 05, 2009, 11:29:16 PM

Title: Batch Png to Fsh tool
Post by: null45 on June 05, 2009, 11:29:16 PM
This is a tool I wrote to convert multiple png / bmp images into fsh images.
It takes a list of images and converts each image into a fsh file of the same name.

(https://www.dropbox.com/s/iupaotyey2g9jwg/batfsh458.png?raw=1)

The mipmap combo box selects the type of mipmaps to use.
The "Compress dat" function compresses the items when inserting them into the dat.

The simplest way to create a batch list is to drag and drop a group of images onto the list.
Draging and dropping a group of images onto the "Add" button will add them to the existing list.

The other way to insert images is the "Add" function, this relies on "Groupid.txt" for the Group to assign the images to and "instRange.txt" for the Instance range to use.

In the "Add" function the Group id in the Group box overrides the one in "Groupid.txt" and if the image contain transparency and the file name begins with hd it will be a 32-bit hd fsh, if the image is not transparent and the file name begins with hd it will be a 24-bit hd fsh.

If the file name begins with 0x it will use the file name as the Instance.

To change the group, instance or Fsh Type of an image you must select that image in the list.

Dragging and dropping a group or folder of images onto the program will add them to a new list.

Download: Png to Fsh Batch (http://sc4devotion.com/csxlex/lex_filedesc.php?lotGET=2255)

I hope it is useful  ;)   
Title: Re: Batch Png to Fsh tool
Post by: Pat on June 05, 2009, 11:36:14 PM
sweet new tool here Null!! I will have to check this out further when I get home next week...
Title: Re: Batch Png to Fsh tool
Post by: sithlrd98 on June 06, 2009, 03:00:19 AM
Yes it is! Been using 1.2 and it has made texture replacement so much faster! Again , thanks for doing this!

Just noticed that now you truly have made this exactly as I had hoped...completely effortless! What you see on the right is exactly the same as the left! You don't know how much time this saves me and other re-texture modders. I should have asked you about this much sooner! Thank you again!


Jayson
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 10, 2009, 09:33:19 PM
A few bugs fixed. File version should now be "1.3.1.0"  :)
Title: Re: Batch Png to Fsh tool
Post by: sithlrd98 on June 10, 2009, 09:42:32 PM
Getting "Invalid File. This error has been forwarded to MediaFire's development team."


Working now....
Jayson
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 24, 2009, 10:04:10 PM
Some new features added and a few bugs fixed.  ;)
Title: Re: Batch Png to Fsh tool
Post by: sithlrd98 on June 24, 2009, 10:06:37 PM
So...whats new? I had not noticed any bugs in the last version. I've used it a few times lately and am grateful for it!

Jayson
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 25, 2009, 11:27:06 AM
Quote
So...whats new? I had not noticed any bugs in the last version. I've used it a few times lately and am grateful for it!

The ability to change the Group / Instance id and Fsh type of the selected item has been added.

As far as bugs go a setting in the list of batch file list that allowed more than one file to be selected has been fixed, that setting would break the radio buttons that set the last digit in the instance id and a bug in the validation of letters entered into group / instance id text boxes.
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 29, 2009, 06:17:15 PM
Support for Dragging and Dropping groups of images into the list added, the "Batch png" function has been combined with the
Add" function and a crash and some bugs fixed.  ;)
Title: Re: Batch Png to Fsh tool
Post by: timcravey on September 11, 2009, 05:43:55 PM
I cry.  It is surely too much for simple me.  I try; but I do not understand how.
Title: Re: Batch Png to Fsh tool
Post by: sithlrd98 on September 11, 2009, 05:50:13 PM
Tim...what prob are you having? I've been using this and Nulls other tools for awhile.I assume your trying to do something for Sim Mars?

Jayson
Title: Re: Batch Png to Fsh tool
Post by: null45 on September 19, 2009, 05:54:58 PM
Command line switches added, "Batch.txt" function removed and multiple bugs fixed.  ;)
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 01, 2009, 12:52:33 AM
The ability to drag and drop folders of images onto the program to process added, multiple bugs fixed.
File version updated to 1.4.3.0    :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: Shadow Assassin on November 16, 2009, 12:52:45 AM
Having a problem with PNG to FSH batch:

I got the following error:
Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at PngtoFshBatchtxt.Form1.processbatchbtn_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
PngtoFshBatch
    Assembly Version: 1.4.3.0
    Win32 Version: 1.4.3.0
    CodeBase: file:///D:/Programs/PngtoFshBatch/PngtoFshBatch.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SynapticEffect.SimCity
    Assembly Version: 0.3.1.41619
    Win32 Version: 0.3.1.41619
    CodeBase: file:///D:/Programs/PngtoFshBatch/SynapticEffect.SimCity.DLL
----------------------------------------
FSHLib
    Assembly Version: 0.3.1.32186
    Win32 Version: 0.3.1.32186
    CodeBase: file:///D:/Programs/PngtoFshBatch/FSHLib.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

What am I doing wrong here? :\
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 16, 2009, 10:36:04 PM
The only thing that I can think of is that the list may be messed up in some way. 
Do you have any steps to reproduce the issue?
Title: Re: Batch Png to Fsh tool
Post by: Shadow Assassin on November 17, 2009, 06:22:21 PM
Well, I assumed I had to create five textures - one for each zoom, right?

Only three showed up in the list when I dropped the five textures in place... I tried outputting and bam, I get hit with the 'out of range' error. This is with texture mipmap turned off (I assume it's the setting that creates the various textures per zoom).

Then I tried just the zoom 5 texture... and it worked just fine.
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 17, 2009, 10:55:36 PM
Well, I assumed I had to create five textures - one for each zoom, right?

The "Automatically  process Mips" generates the scaled down files when the larger images are converted.

The filter now properly removes the files 64 x 64 or smaller from the list.
File version updated to 1.4.4.0.  :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 23, 2009, 10:11:54 PM
A small update to display tooltips describing the functions and allow folders of images to be dropped onto the list and "Add" button.
File version updated to 1.4.4.1.  ;)
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on December 09, 2009, 03:38:36 PM
I've been going Alpha-less and relying on the PNG transparency since I switched over to PngToFshBatch, which has saved me countless hours. :thumbsup:  I've also been updating regularly, but with the past couple versions, I've had some issues with the PNG transparency not being carried over to the lower zoom MIPs.  The transparency is coming across on the Zoom 5 PNGs, but I've been getting black space on Zooms 1-4. 

(http://img697.imageshack.us/img697/6594/pngissue120920091.jpg)

(http://img138.imageshack.us/img138/5792/pngissue120920092.jpg)

I'm using the "Automatically process Mips" and "Compress Dat" options, with the "New Dat/Save Dat" method of exporting, and I've tried every possible format setting (24-bit RGB, 32-bit ARGB, DXT 1--my normal setting, and DXT 3) and gotten the same results.  The PNGs in question are standard definition (128x128). 

The RHW intersection textures shown above were processed on November 12th, so they would have been done using 1.4.3.0, and I'm still having the issue with 1.4.4.1.  It also occurred with 1.4.4.0.   The other textures shown that aren't affected were processed with 1.3.1.0.

Thanks in advance for any assistance! :)

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on December 09, 2009, 08:04:32 PM
There was a bug in the Alpha map from transparency function that would cause it to only detect the alpha pixels that were zero, another bug in was that it would always write pure black instead of the correct shade of color.

File version updated to 1.4.4.3

I hope that fixes the problem.  ;)
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on December 10, 2009, 02:37:44 AM
Thanks again for the quick reply and solution, null!  It works perfectly here on my end! :thumbsup:

-Alex
Title: Re: Batch Png to Fsh tool
Post by: Shadow Assassin on December 12, 2009, 10:06:07 PM
Just a question - is it at all possible to create a Photoshop plugin that saves .fsh files directly? Would be exceedingly handy and remove another step from the FSH creation process.

The only problem I could see, though, would be with alphas...
Title: Re: Batch Png to Fsh tool
Post by: null45 on December 13, 2009, 09:36:35 PM
Writing a plugin to allow photoshop to load and save fsh files would be extremely complex, although a java script automation script could probably save a psd file and then pass the file to a program that would convert it into a fsh.
Title: Re: Batch Png to Fsh tool
Post by: Jonathan on February 07, 2010, 11:51:26 AM
The tool will not let me convert using 32-bit ARGB, it will only let me use DXT1 and DXT3?
However with DXT3 the quality is awful.
Title: Re: Batch Png to Fsh tool
Post by: null45 on February 08, 2010, 09:02:45 PM
If the image is smaller than 256x256 it only allows DXT1 or DXT3 to be used.

The DXT3 compression quality is a known issue that was first raised by SimFox, I wrote a small tool that uses Squish  (http://code.google.com/p/libsquish/)to compress the image into a fsh with higher quality than the one used by FshTool it is here (http://www.simtropolis.com/forum/messageview.cfm?catid=41&threadid=108083&STARTPAGE=2&FTVAR_FORUMVIEWTMP=Linear#1659579).

I should be able to incorporate the higher quality DXT3 fsh compression from Fshwrite into PngtoFshBatch.  ;)
Title: Re: Batch Png to Fsh tool
Post by: Jonathan on February 09, 2010, 01:43:33 AM
is there a reason for that?
Also do you know what SC4tool uses?
Title: Re: Batch Png to Fsh tool
Post by: null45 on February 09, 2010, 02:57:37 PM
Quote from: Jonathan
is there a reason for that?
When that was put in I thought from what was discussed in the High Definition Textures (http://sc4devotion.com/forums/index.php?topic=7430.440) thread that only images 256x256 or larger would benefit from the different format.

Quote from: Jonathan
Also do you know what SC4tool uses?

SC4Tool uses the FshTool DXT compression, without the source code this cannot be fixed. 
Title: Re: Batch Png to Fsh tool
Post by: null45 on February 13, 2010, 11:09:39 PM
Updated to use the higher quality Fshwrite compression when writing DXT1 or DXT3 fsh files.

File version updated to 1.4.4.4.   :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on February 14, 2010, 01:06:38 PM
Seem to be running into some issues with the "Save dat" feature.  I'm getting this error message:

Object reference not set to an instance of an object.
 at PngtoFshBatchtxt.Form1.RebuildDat(DatFile4 inputdat)
 at PngtoFshBatchtxt.Form1.saveDatbtn_Click(Object sender, Event Args e)

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on February 14, 2010, 02:45:49 PM
That bug has been fixed, File version updated to 1.4.4.5   ;)



 
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on February 14, 2010, 08:34:25 PM
That bug has been fixed, File version updated to 1.4.4.5   ;)

Wow, that was quick!  Thanks again for all your hard work on this tool, null! :thumbsup:

-Alex
Title: Re: Batch Png to Fsh tool
Post by: Shadow Assassin on April 07, 2010, 09:34:20 PM
Hey - just wondering about something: I'm trying to import a bunch of zoom 3 images (zoom 3 only, no others), and PNG2FSH just ignores these images and won't write a new .dat... is this a bug or does it not like 32x32 PNGs?
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 10, 2010, 01:30:06 AM
It only handles the zoom 5 images and would automatically create the images for the other zooms if the "Automatically process Mips" option is checked.
Title: Re: Batch Png to Fsh tool
Post by: Shadow Assassin on April 15, 2010, 07:49:36 PM
Ah okay -- is there any chance at all that it could be allowed to handle images for other zooms? Right now, the only option is FishMAN and that is really quite buggy.
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 15, 2010, 09:14:34 PM
The ability to load images from the other zooms was removed due to a crash if the images in the list were different sizes.

The "Save dat" function would only work if all the zoom levels are present, although it would save the zoom 5 images without the other zoom levels SC4 probably would not like that.  :D
 
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on June 22, 2010, 03:25:55 AM
I've been running into an issue with compression on Zoom 3 FSHs--a few other NAMites have run into a similar issue as well.  It seems that some of the details are going missing in that zoom, almost as if an upsized Zoom 2 FSH is going in its place.

It's particularly apparent on the RHW-8 textures.

Here's Zoom 4:
(http://img193.imageshack.us/img193/2254/zoom4.jpg)

And here's Zoom 3:
(http://img80.imageshack.us/img80/3323/zoom3o.jpg)

The problem seems to persist regardless of the size of the initial source PNG.  The ones used in that particular example are from 128x128 source files run through "Automatically Process Mips".  It occurs with 256x256 PNGs as well.

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 22, 2010, 11:00:59 PM
Quote from: Tarkus
I've been running into an issue with compression on Zoom 3 FSHs--a few other NAMites have run into a similar issue as well.  It seems that some of the details are going missing in that zoom, almost as if an upsized Zoom 2 FSH is going in its place.

It definitely is not a up-scaled Zoom 2 fsh.  :D
Does the same thing happen in SC4Tool?

Quote from: Tarkus
The problem seems to persist regardless of the size of the initial source PNG.  The ones used in that particular example are from 128x128 source files run through "Automatically Process Mips".  It occurs with 256x256 PNGs as well.

That would make sense because it is the same function (I use the same method as SC4Tool, GetThumbnailImage (http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx)) that scales the Zoom 5 images regardless of size. 

Title: Re: Batch Png to Fsh tool
Post by: Tarkus on June 23, 2010, 02:15:58 AM
I just ran a series of tests with the most recent FSHLib and SC4Tool . . . same issue appears to be happening there as well, so I'm wondering if it may be FSHLib related.  A fellow NAMite who is on Windows XP had reported to me that he hadn't been running into any issues with the new FSHLib and SC4Tool, but another colleague, who is on Windows 7 like I am, reported he was running into the same issue.

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 23, 2010, 11:51:56 PM
The GetThumbnailImage (http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx) function apparently doesn't want to work correctly on Windows 7  ::),  I now use the DrawImage (http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawimage.aspx)  function which seems to be higher quality.

Added a check box for Fshwrite Compression, File version updated to 1.4.4.6.  :)
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on June 24, 2010, 07:16:59 PM
null, you've come through yet again!  I just tried re-importing those RHW-8 textures and they look spot-on in Zoom 3 now--seems everything looks a little sharper, in fact. 

Thank you again for your very quick assistance on this--you've made a lot of NAMites very happy! :thumbsup:

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on June 24, 2010, 11:29:04 PM
It should be a bit sharper than GetThumbnailImage, I am actually using the second highest quality setting because the highest quality setting seemed to blur.   :thumbsup:

 
Title: Re: Batch Png to Fsh tool
Post by: ebina on July 10, 2010, 08:56:46 AM
I use version 1.4.4.6 on Windows 7 x64. If I enable Compress dat and/or Fshwrite compression, and processed images by using Save dat, the tool generates FSH of file size 0. Everytime file size of zoom3 textures generated from the same images becomes 0. Redoing images themselves didn't help. Due to those failed FSHs I cannot save a .dat file after changing TGIs in the Reader. Also the Reader crashes by clicking them.

(http://img696.imageshack.us/img696/2050/test3i.gif)
This is contents of Test3_Compress dat_Fshwrite compression.dat in the archive.

I realized that Process button doesn't bring up the problem. Although some manual processes will be needed in the Reader, I'm going to use it for redoing those failed FSHs as a temporary solution.
For testing, I uploaded problematic images, and some .dat files that include failed FSHs. Could you take a look at these? http://www.mediafire.com/?gjqmvg0yqoj
Title: Re: Batch Png to Fsh tool
Post by: null45 on July 10, 2010, 09:59:20 PM
Strange it seems to be an issue with way DatGen saves the dat, why it would only affect one file I have no idea.  ()what()
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on July 10, 2010, 10:10:45 PM
I used to run into a similar issue with PNGs that were mostly transparent with the previous version.  It seems to have gone away with the latest version and with Fshwrite Compression checked.

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on July 20, 2010, 09:12:43 PM
With those files the compression only seems to add to the file size at zoom 3 and below, and due to the way DatGen saves the files into the dat Fshwrite compression is useless when using the "Save dat" function.

The new dat saving code should hopefully fix both of those issues.  :D

File version updated to 1.4.4.7.


Title: Re: Batch Png to Fsh tool
Post by: ebina on August 13, 2010, 05:42:27 AM
Thank you for the update (and sorry for the late reply). I tested the same images in 1.4.4.7. The new version seems to not create bad FSH.

Quote
...and due to the way DatGen saves the files into the dat Fshwrite compression is useless when using the "Save dat" function.

In 1.4.4.6 the option certainly reduced file size, so I don't think that it was useless. But since I can use the tool without minding the bug 1.4.4.7 is a lot better to me.

Error message appears when I checked both compression options in 1.4.4.7. As you mentioned that Fshwrite Compression is useless when using "Save dat", I know checking both options is meaningless, the error can be prevented by not checking the option. I just wanted to let you know a new error.

(http://img291.imageshack.us/img291/2025/1447error.gif)

I googled and found the translation below. I'm not sure if it is correct or not.

Quote
Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
Title: Re: Batch Png to Fsh tool
Post by: null45 on August 19, 2010, 01:30:40 AM
That bug should hopefully be fixed, and the Mipmap saving should also be slightly higher quality.

File version updated to 1.4.4.8.   ;)
Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on September 21, 2010, 12:27:10 PM
Excellent Program!  I just started making textures and I don't even know what I would do without this.

Is there a maximum amount of files/size that this can make?

I am new to making images (just played with something other than MSpaint for the first time today) and I am wondering what the best quality would be.  I am making 1024x1024 terrain textures.
Title: Re: Batch Png to Fsh tool
Post by: null45 on September 21, 2010, 10:58:15 PM
Quote
Is there a maximum amount of files/size that this can make?

It would run slower on larger files but should work fine.

Quote
I am new to making images (just played with something other than MSpaint for the first time today) and I am wondering what the best quality would be.  I am making 1024x1024 terrain textures.

Fshwrite compression for the DXT1 or DXT3 images would be smaller in size  than the 24-bit or 32-bit HD textures but some data would be lost during compression.  ;)
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 09, 2010, 08:48:47 PM
Updated to work with images 64x64 or smaller.

The busy cursor will now be displayed during long operations and processing should be faster for the alpha of larger images.

File version updated to 1.4.4.9.  :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on December 03, 2010, 01:05:05 PM
A lowly request...  It appears to not like files with extensions that are capital letters.
Title: Re: Batch Png to Fsh tool
Post by: null45 on December 03, 2010, 05:15:57 PM
That bug and a bug with the command line processing fixed, file version updated to 1.5.0.0.  ;)
Title: Re: Batch Png to Fsh tool
Post by: FlyHigh on January 01, 2011, 03:52:21 PM
Hi everyone.

I'm new to PNG2FSH so this might have a simple answer.
I'm getting this error message whenever I check the 'Automatically process Mips'

(http://i483.photobucket.com/albums/rr194/Rings_of_Saturn/SimCity%204/th_error.jpg) (http://s483.photobucket.com/albums/rr194/Rings_of_Saturn/SimCity%204/?action=view&current=error.jpg)

What am I doing wrong?

Also, is it too much to ask if you could make a tutorial for the tool?

Thanks :)
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 02, 2011, 01:25:26 PM
What is the size of the image you are trying to process?

The "Parameter is not valid" error is a problem with GDI+, unfortunately it does not say what is wrong with the parameter.    &mmm
Title: Re: Batch Png to Fsh tool
Post by: FlyHigh on January 02, 2011, 01:30:27 PM
I've tried both a 600x600 and a 256x256   &mmm
Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on January 02, 2011, 02:47:45 PM
For automatically processing mips I believe you need 128x128.  I don't think 600x600 would ever work for this program, as the textures need to be squares with a length of a binary amount of pixels to work in SC4. (1,2,4,8,16,32,64,128,256,512...)
Title: Re: Batch Png to Fsh tool
Post by: FlyHigh on January 02, 2011, 02:53:38 PM
Isn't 128x128 the same as SC4Tool? I decided to use png2fsh because I need more detail on base textures for zoom 6. However I will try to work with the sets of px you've mentioned and report back  ;)
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 02, 2011, 04:54:18 PM
For automatically processing mips I believe you need 128x128.  I don't think 600x600 would ever work for this program, as the textures need to be squares with a length of a binary amount of pixels to work in SC4. (1,2,4,8,16,32,64,128,256,512...)

600x600 would work, but only if you were using Hardware Rendering.

The "Parameter is not valid" error is now fixed.
File version updated to 1.5.0.1.  :thumbsup:

Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on January 23, 2011, 11:49:36 AM
Thanks for the great work and support Null45 :)

I've started using this program for large amounts of files at a time, namely 168 files that come to 126mb.  The program works just fine with this, but I have some feedback.

Processing these files takes some time, and so does the saving post processing.  Could the "save as" function ask for a file name before it starts processing?

I run dual core, and while processing this program uses 100% of the CPU (good).  However, while saving the file, it only uses 50%.

Can we get a progress bar?  :P

Thanks again.       
 
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 23, 2011, 10:12:35 PM
Processing these files takes some time, and so does the saving post processing.  Could the "save as" function ask for a file name before it starts processing?

That would make more sense than the current method, why process the files if the user cancels the "Save Dat" dialog.

I run dual core, and while processing this program uses 100% of the CPU (good).  However, while saving the file, it only uses 50%.

Can we get a progress bar?  :P

The processing runs in the background so it would tie up the second core and keep both cores at 100%, during saving it would only keep the first core at 100% meaning only 50% of the CPU's capacity would be used.

A status bar displaying the progress of the processing has been added, and the "Save Dat" dialog will prompt for a file name before processing.

File version updated to 1.5.0.2.  :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on January 24, 2011, 10:50:45 AM
I was pointing out the 50% thing because perhaps that it was an oversight.  This program was one of the first on my computer to actually use 100%, so that made me happy that I had installed all my drivers correctly.

Thanks for the update.  Everything went well the first run.  I accidentally processed the mips, so no good for a terrain texture, we will see as I go.

Edit: Is there a Batch Fsh to Png tool out there?

Hmm, actually, something to note about the progress bar:  Seems that it takes into account the time it takes to save the file.  At "processing image 168 of 168" I was a little passed 50% of the bar.  However, "processing image 168 of 168" never went away. I guess this is because "saving" is one large function, so it is "not-done" and then "done" faster than I can see the progress bar change. 

I don't know.  I like that this program is small, and don't want to clutter it up too much.  Perhaps the processing could take up the whole 100% of the progress bar, and then "saving" could be displayed where the "ready" is?  At this point I am feeling like I am just telling you to do things...  My only hope is that you are a programmer by trade, and these ideas help you in ways other than SC4.   
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 24, 2011, 04:17:23 PM
Hmm, actually, something to note about the progress bar:  Seems that it takes into account the time it takes to save the file.  At "processing image 168 of 168" I was a little passed 50% of the bar.  However, "processing image 168 of 168" never went away. I guess this is because "saving" is one large function, so it is "not-done" and then "done" faster than I can see the progress bar change. 

That was something I overlooked, the saving is now done in the background so the progress bar is updated correctly.
Strangely the "Building Dat" step of the "Save Dat" function using 16 files runs too fast for the progress bar to even register and the status text
only appears for the last file.  ::)

File version updated to 1.5.0.3.
Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on January 28, 2011, 07:19:19 PM
Quote
Strangely the "Building Dat" step of the "Save Dat" function using 16 files runs too fast for the progress bar to even register and the status text only appears for the last file.

With 168 700kb files I can see the bar move through the "Building Dat" step, although it is still very fast.  The last file does stay for longer than the rest though.  Perhaps that is the whole file saving?  The time it takes to save the whole file in Reader is about the same amount of time that "Building 168 of 168" is displayed.  (I am using instance 0xE0, which happens to be an unused cliff texture, so I must make the zooms for it).

Another round of applause here.  &apls  Not once has this program had any trouble.
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on January 28, 2011, 07:23:47 PM
The latest version has been working wonders for me as well, and I absolutely love having the status bars.  I've imported literally thousands of RHW textures as part of the V5-Spec revamp, and it's worked like a charm.  Took me only about 15 minutes and the process was basically automatic.  It would have probably taken me a few weeks just to import stuff had it not been for this tool. :thumbsup:

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 29, 2011, 04:20:56 PM
With 168 700kb files I can see the bar move through the "Building Dat" step, although it is still very fast.  The last file does stay for longer than the rest though.  Perhaps that is the whole file saving?  The time it takes to save the whole file in Reader is about the same amount of time that "Building 168 of 168" is displayed.  (I am using instance 0xE0, which happens to be an unused cliff texture, so I must make the zooms for it).

Another round of applause here.  &apls  Not once has this program had any trouble.

That would be the whole file saving, the status text should now display "Saving Dat" when the dat is being saved.

File version updated to 1.5.0.4.  :)
Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on May 01, 2011, 05:30:25 PM
Hi,  :)

Now I have troubles.

(http://img683.imageshack.us/img683/7692/errorjs.jpg)

This has happened a couple times, but now that there are many other textures to import, I have time to post.  ::)  most of the time this can be fixed by changing the image ever so slightly.  To me, it's really not a big deal that it happens, it's just that it would be nice to know which image caused this.
Title: Re: Batch Png to Fsh tool
Post by: null45 on May 01, 2011, 06:18:17 PM
This is a problem with the Qfs compression, what is happening is the image fails to compress for some reason and it crashes when it runs out of space.

I have added more error checking to the compression function that should hopefully solve that issue, the file version of FshDatIO.dll has been updated to 1.2.0.3.  :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 01, 2011, 11:54:19 PM
The processing status is now shown in the Windows 7 taskbar, JumpList support added for folders dropped onto the list and a few other bugs fixed.

Also refactored to potentially allow for translation.

File version updated to 1.5.0.5.  ;)

Title: Re: Batch Png to Fsh tool
Post by: null45 on December 04, 2011, 03:19:40 AM
Fixed a bug in the JumpList argument handling, File version updated to 1.5.0.6.
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 11, 2012, 05:15:36 PM
The images in the list can now be added into an existing dat, replacing any existing files with the same TGI ids.
A few bugs in the dat saving fixed, File version updated to 1.5.0.7.  :)
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 20, 2012, 04:10:00 PM
HD files of any size can now be saved, file version updated to 1.5.0.8.

Title: Re: Batch Png to Fsh tool
Post by: Lowkee33 on January 27, 2012, 05:17:39 PM
Hi.  I just upgraded to the most recent version and am having some troubles.  Batch Png to Fsh keeps making empty Dats with my 1024x1024 textures.  At first the problem seemed to be that the names of the files were out of the InstRange, but that isn't the case.  A 128x128 texture that has "automatically process mips" is skipping the "0" zoom texture.

Hmm, My guess is that it has to do with the merging capability.  A randomly named 128x128 texture was saved without the "0" zoom.  I processed it again, and got all 5 made.  Then I processed the 1024x1024 (with a specific name) and it was added to the dat correctly.

To be honest, I'm not sure if I like the merging.  I think that DatPacker already does a good job at merging files.  I see the convenience though.
Title: Re: Batch Png to Fsh tool
Post by: null45 on January 27, 2012, 11:37:48 PM
Hi.  I just upgraded to the most recent version and am having some troubles.  Batch Png to Fsh keeps making empty Dats with my 1024x1024 textures.  At first the problem seemed to be that the names of the files were out of the InstRange, but that isn't the case.  A 128x128 texture that has "automatically process mips" is skipping the "0" zoom texture.

Hmm, My guess is that it has to do with the merging capability.  A randomly named 128x128 texture was saved without the "0" zoom.  I processed it again, and got all 5 made.  Then I processed the 1024x1024 (with a specific name) and it was added to the dat correctly.

To be honest, I'm not sure if I like the merging.  I think that DatPacker already does a good job at merging files.  I see the convenience though.

The dat saving and command line processing are now fixed, file version updated to 1.5.0.9.  ;)
Title: Re: Batch Png to Fsh tool
Post by: null45 on May 12, 2012, 11:05:40 PM
Added support for creating files with embedded mipmaps, file version updated to 1.5.1.0.
Title: Re: Batch Png to Fsh tool
Post by: NCGAIO on May 13, 2012, 05:48:26 PM
 ;D  ;D  ;D  ;D  ;D  ;D
 :thumbsup: Great as always ... thanks!
Title: Re: Batch Png to Fsh tool
Post by: Tarkus on May 29, 2012, 11:25:49 AM
For some reason, with the new version, the alpha transparency seems to not be working for me on Zooms 4 and lower, regardless of whether PNG transparency or separate Alpha maps are used.

-Alex
Title: Re: Batch Png to Fsh tool
Post by: null45 on May 29, 2012, 06:04:22 PM
For some reason, with the new version, the alpha transparency seems to not be working for me on Zooms 4 and lower, regardless of whether PNG transparency or separate Alpha maps are used.

-Alex

That is now fixed, file version updated to 1.5.1.1.  :thumbsup:
Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 04, 2013, 06:32:49 PM
I tried today this little tool but I'm having some problems. Every time I try to batch a file or a group of files, it gave me this message "Index was outside the bounds of the array". Any clues why? The texture is 128x128, png saved with photoshop. I'm attaching one of the textures. If I use SC4Tool (Texture creator) it works, but I have a large number to process and this tool it's the right one for that job, if I only could make it to work.
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 05, 2013, 12:27:42 AM
I tried today this little tool but I'm having some problems. Every time I try to batch a file or a group of files, it gave me this message "Index was outside the bounds of the array". Any clues why? The texture is 128x128, png saved with photoshop. I'm attaching one of the textures. If I use SC4Tool (Texture creator) it works, but I have a large number to process and this tool it's the right one for that job, if I only could make it to work.

That message usually appears if an image fails to compress, although it could be something else.

Is there any additional text after the message?


Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 05, 2013, 03:20:58 AM
I tried today this little tool but I'm having some problems. Every time I try to batch a file or a group of files, it gave me this message "Index was outside the bounds of the array". Any clues why? The texture is 128x128, png saved with photoshop. I'm attaching one of the textures. If I use SC4Tool (Texture creator) it works, but I have a large number to process and this tool it's the right one for that job, if I only could make it to work.

That message usually appears if an image fails to compress, although it could be something else.

Is there any additional text after the message?



No, just that. I also tried your other tool Multifsh and it gave me the same error, but I remember it show some more info. I'm not home now but I'll try to get that info later. Anyway, if you could just test that texture yourself, you may get that info as well. Thx for your help.
Title: Re: Batch Png to Fsh tool
Post by: Swordmaster on April 05, 2013, 03:40:40 AM
I've tested the texture and it works fine. So you may be missing something (DLLs?)


Cheers
Willy
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 05, 2013, 05:41:38 AM
No, just that. I also tried your other tool Multifsh and it gave me the same error, but I remember it show some more info. I'm not home now but I'll try to get that info later. Anyway, if you could just test that texture yourself, you may get that info as well. Thx for your help.

What version are you using?
If you are using Photoshop 6.0 or later you could use the Fsh format plugin as a workaround.

I've tested the texture and it works fine. So you may be missing something (DLLs?)

It works for me also, without the stack trace I have no clue what is crashing. &mmm
Title: Re: Batch Png to Fsh tool
Post by: vortext on April 05, 2013, 08:40:16 AM
The same happens for me when I try to process a large number of textures at once. Try breaking it down into smaller batches.
Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 05, 2013, 03:33:18 PM
With me it happens regardless I try to process one or several images. I tried Multifsh and when the program starts it gives me this error:

(http://img18.imageshack.us/img18/357/msnetframeworkerror.jpg)

And the text is:

Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at loaddatfsh.Multifshfrm.RandomHexString(Int32 length)
   at loaddatfsh.Multifshfrm.Multifshfrm_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5466 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
Multifshview
    Assembly Version: 1.3.0.8
    Win32 Version: 1.3.0.8
    CodeBase: file:///C:/Users/Silvio/Desktop/MultiFsh/Multifshview.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.WindowsAPICodePack.Shell
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///C:/Users/Silvio/Desktop/MultiFsh/Microsoft.WindowsAPICodePack.Shell.DLL
----------------------------------------
FshDatIO
    Assembly Version: 1.2.0.8
    Win32 Version: 1.2.0.8
    CodeBase: file:///C:/Users/Silvio/Desktop/MultiFsh/FshDatIO.DLL
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.5420 built by: Win7SP1
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Microsoft.WindowsAPICodePack
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///C:/Users/Silvio/Desktop/MultiFsh/Microsoft.WindowsAPICodePack.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.



If I ignore and try to process an image, then the message "Index was outside the bounds of the array" comes up like in the other tool BatchPng to Fish

(http://img197.imageshack.us/img197/9215/multifsherror2.jpg)

By the way, I use Photoshop CS5 Extended and the images where made from slicing an image on PNG format.
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 05, 2013, 09:17:43 PM
That should now be fixed in both tools, file version updated to 1.5.1.2.
Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 06, 2013, 08:14:51 AM
Still the same :'(

This time, as I have a dual system boot, I tried from within Windows XP. As you cam see from the image attached, I have the NET Framework installed (3.5 SP1) and from the files details from MultiFSH that it's the right version. Still the same kind of message ()what().

Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at loaddatfsh.Multifshfrm.RandomHexString(Int32 length) in C:\Dev_projects\sc4\loaddatfsh\Multifshfrm.cs:line 2223
   at loaddatfsh.Multifshfrm.Multifshfrm_Load(Object sender, EventArgs e) in C:\Dev_projects\sc4\loaddatfsh\Multifshfrm.cs:line 2037
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3643 (GDR.050727-3600)
    CodeBase: file:///D:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Multifshview
    Assembly Version: 1.3.0.9
    Win32 Version: 1.3.0.9
    CodeBase: file:///D:/Documents%20and%20Settings/Propriet%E1rio/Ambiente%20de%20trabalho/MultiFsh/Multifshview.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3645 (GDR.050727-3600)
    CodeBase: file:///D:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3644 (GDR.050727-3600)
    CodeBase: file:///D:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3644 (GDR.050727-3600)
    CodeBase: file:///D:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
FshDatIO
    Assembly Version: 1.2.0.9
    Win32 Version: 1.2.0.9
    CodeBase: file:///D:/Documents%20and%20Settings/Propriet%E1rio/Ambiente%20de%20trabalho/MultiFsh/FshDatIO.DLL
----------------------------------------
Microsoft.WindowsAPICodePack.Shell
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///D:/Documents%20and%20Settings/Propriet%E1rio/Ambiente%20de%20trabalho/MultiFsh/Microsoft.WindowsAPICodePack.Shell.DLL
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.1 built by: SP
    CodeBase: file:///D:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Microsoft.WindowsAPICodePack
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///D:/Documents%20and%20Settings/Propriet%E1rio/Ambiente%20de%20trabalho/MultiFsh/Microsoft.WindowsAPICodePack.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///D:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

The other tool Batch PNG to FSH, does not give any message when it starts, but if I drag a folder or images into the list box, it does nothing, and if I use the Add button and pick an image, it gives that same error message, out of bounds.
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 06, 2013, 04:18:30 PM
The only thing I can think of is to repair your .NET Framework install.



Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 06, 2013, 05:08:34 PM
The only thing I can think of is to repair your .NET Framework install.





I did that already, I even found this little tool called "dotnetfx_cleanup_tool" that cleans up every trace of the net framework, including reg keys and everything. I installed the last version of the Net Framework on my W7 system, and today before I tried the XP, I did the same and installed the 3.5 SP1 for WinXP. Tomorrow I'm going to do that again.
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 06, 2013, 07:25:48 PM
I did that already, I even found this little tool called "dotnetfx_cleanup_tool" that cleans up every trace of the net framework, including reg keys and everything. I installed the last version of the Net Framework on my W7 system, and today before I tried the XP, I did the same and installed the 3.5 SP1 for WinXP. Tomorrow I'm going to do that again.

Then I have no idea what is the problem is.  :(
From the debug info it appears to be failing inside the framework itself, or the location in the stack trace may be wrong.

I could PM you a private build with more logging which may help in isolating the location of the error.
Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 06, 2013, 07:45:13 PM
Yes, if you please. I thought about that too, I even looked for a log file that could have been generated with some more info that could help you understand where the error might be.
Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 07, 2013, 06:38:28 AM
Thx mate, the instant I tested your debug version as it came out from the zip, I discovered the fault. It run well no errors, so, I exit and added my instRange ID and change the group as well to "0986135E". I run the program again and the error immediately came up again and showed me where it was. By mistake, I did not complete the final ID of my texture range separated by coma. Beginner's mistake  &ops

(http://img209.imageshack.us/img209/8296/png2fsherror.jpg)

Maybe if you could add that info to the program's support page would avoid more people to make that mistake ;)
Thank you very much for your help. :thumbsup:

Cheers
Silvio
Title: Re: Batch Png to Fsh tool
Post by: null45 on April 08, 2013, 03:37:15 AM
Maybe if you could add that info to the program's support page would avoid more people to make that mistake ;)

In the Readme it says that it uses the same format as SC4Tool, I assumed that people would set it correctly and never checked the length of the array. ::)

In any case that is fixed, file version updated to 1.5.1.3.
Title: Re: Batch Png to Fsh tool
Post by: Rayden on April 08, 2013, 11:38:16 AM
In the Readme it says that it uses the same format as SC4Tool, I assumed that people would set it correctly and never checked the length of the array. ::)

You never know when a noobie like me comes around $%Grinno$%
Title: Re: Batch Png to Fsh tool
Post by: whatevermind on April 08, 2013, 09:34:34 PM
In the Readme it says that it uses the same format as SC4Tool, I assumed that people would set it correctly and never checked the length of the array. ::)

That part's really confusing actually, especially if you've never used the SC4Tool.
Title: Re: Batch Png to Fsh tool
Post by: Indiana Joe on July 11, 2013, 02:35:50 PM
It's been a few months, I hope this is still supported  %confuso

The radio buttons that choose the End Format aren't working for me.  I can't change it from 0-4 to either of the others.

Figured it out--error on my part.  Move along, nothing to see here... :-[
Title: Re: Batch Png to Fsh tool
Post by: null45 on August 02, 2014, 12:04:36 AM
Fixed a bug with the Process button and embedded mipmaps, file version updated to 1.5.1.4.
Title: Re: Batch Png to Fsh tool
Post by: Apple Delight on November 16, 2014, 05:32:28 PM
I've been having problems with the latest version where I can drag the same group of PNGs to be exported onto the tool but end up with dats that have different missing FSHs on each pass. This is the contents of one the dats the last time that I ran Png to Fsh Batch about a month ago.
(http://www.majhost.com/gallery/Appledelight/issues/png2fshbatch-141117-0.png)
There also seems to be bleeding on some of the FSHs that aren't present in the PNGs.
Compare the broken yellow line of the originals on the left with the FSHs on the right.
The bottom one appears as normal, while the top has a ghost in the gutter.
(http://www.majhost.com/gallery/Appledelight/issues/png2fshbatch-141117-1.png)
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 17, 2014, 01:01:26 PM
Does the Reader also have missing files?

The bleeding appears to be artifacts of the DXT compression, you can save those files as uncompressed 32-bit ARGB to fix the issue (at the expense of file size).
Title: Re: Batch Png to Fsh tool
Post by: Apple Delight on November 19, 2014, 07:42:56 PM
I'm not really that familiar with the Reader to notice if the same files are missing (although some are missing), but I have noticed that the many TGI's are repeated but have different file sizes/numbers/locations reported.
(http://www.majhost.com/gallery/Appledelight/issues/png2fshbatch-141117-2.png)
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 20, 2014, 06:57:31 PM
That is strange, there is no reason it should be duplicating files.
Could you upload a zip containing the images you are using?

Title: Re: Batch Png to Fsh tool
Post by: Apple Delight on November 20, 2014, 07:46:38 PM
Archive attached.
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 21, 2014, 04:30:32 AM
It looks like the duplicate and missing files may have caused by a bug in my code. &mmm

That is now fixed, file version updated to 1.5.1.5.
Title: Re: Batch Png to Fsh tool
Post by: Indiana Joe on December 17, 2014, 08:40:29 PM
Always crashes if I try to add more than 50 textures on Win 8.1

EDIT:  Re-installed and restarted, now it won't let me add even one texture and gives me this exception.

Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index must be within the bounds of the List.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.Insert(Int32 index, T item)
   at PngtoFshBatchtxt.Form1.BuildAddList(Int32 startIndex) in C:\Dev_projects\sc4\PngtoFshBatchtxt\Form1.cs:line 1572
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8009 (FX35W81RTMGDR.050727-8000)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
PngtoFshBatch
    Assembly Version: 1.5.1.5
    Win32 Version: 1.5.1.5
    CodeBase: file:///C:/Users/mmatunis/Downloads/PngtoFshBatch_1.5.1.5/PngtoFshBatch/PngtoFshBatch.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8008 (FX35W81RTMGDR.050727-8000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8009 (FX35W81RTMGDR.050727-8000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8007 (FX35W81RTMGDR.050727-8000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
FshDatIO
    Assembly Version: 1.3.0.1
    Win32 Version: 1.3.0.1
    CodeBase: file:///C:/Users/mmatunis/Downloads/PngtoFshBatch_1.5.1.5/PngtoFshBatch/FshDatIO.DLL
----------------------------------------
Microsoft.WindowsAPICodePack.Shell
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///C:/Users/mmatunis/Downloads/PngtoFshBatch_1.5.1.5/PngtoFshBatch/Microsoft.WindowsAPICodePack.Shell.DLL
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.7903 built by: Win9Rel
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Microsoft.WindowsAPICodePack
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///C:/Users/mmatunis/Downloads/PngtoFshBatch_1.5.1.5/PngtoFshBatch/Microsoft.WindowsAPICodePack.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8009 (FX35W81RTMGDR.050727-8000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Title: Re: Batch Png to Fsh tool
Post by: null45 on December 17, 2014, 11:24:25 PM
Always crashes if I try to add more than 50 textures on Win 8.1
Could you attach the images that cause this?

As far as the second crash is concerned, I know where the crash occurs but have no idea what might be causing it. :(
Title: Re: Batch Png to Fsh tool
Post by: Indiana Joe on December 19, 2014, 11:26:24 PM
Always crashes if I try to add more than 50 textures on Win 8.1
Could you attach the images that cause this?

As far as the second crash is concerned, I know where the crash occurs but have no idea what might be causing it. :(

Solved it; a couple of textures were missing a digit in their names.
Title: Re: Batch Png to Fsh tool
Post by: null45 on December 20, 2014, 04:21:38 AM
That crash is now fixed.
File version updated to 1.5.5.6.
Title: Re: Batch Png to Fsh tool
Post by: Indiana Joe on December 20, 2014, 03:13:41 PM
That crash is now fixed.
File version updated to 1.5.5.6.

I'll assume that instead of a crash you now get an error message about invalid ID's?
Title: Re: Batch Png to Fsh tool
Post by: null45 on December 20, 2014, 07:04:04 PM
I'll assume that instead of a crash you now get an error message about invalid ID's?

It turns out that when fixing that crash I introduced a regression which broke the ID reading entirely.  &ops

That is now fixed and it will now give an error message in invalid IDs.
File version updated to 1.5.1.7.


Title: Re: Batch Png to Fsh tool
Post by: Indiana Joe on December 20, 2014, 08:19:50 PM
I'll assume that instead of a crash you now get an error message about invalid ID's?

It turns out that when fixing that crash I introduced a regression which broke the ID reading entirely.  &ops

That is now fixed and it will now give an error message in invalid IDs.
File version updated to 1.5.1.7.

Fantastic thanks for all the hard work!
Title: Re: Batch Png to Fsh tool
Post by: null45 on March 16, 2015, 02:27:16 AM
Fixed a crash when the process button is clicked if there are no files in the list and a UI bug with the End format radio buttons.
Fixed a bug with the DBPF header having the wrong version and a potential file corruption issue with saving into an existing dat.
Improved the QFS compression, file version updated to 1.5.3.0.  ;)
Title: Re: Batch Png to Fsh tool
Post by: null45 on March 16, 2015, 08:17:59 PM
Added a missing DLL, file version updated to 1.5.3.1.
Title: Re: Batch Png to Fsh tool
Post by: mgb204 on March 16, 2015, 09:15:53 PM
Thanks for your efforts, they really make working with textures a whole world simpler, these tools mean creators can spend their time making textures and not worrying about how to import/export and all that malarkey. It's great that you are still supporting them and releasing updates, I'm sure many mods have your work to thank for their existence.
Title: Re: Batch Png to Fsh tool
Post by: nos.17 on November 24, 2015, 08:36:25 PM
First off, love the tool! Insofar, its saved me quite a bit of time...even though I have only created around a dozen textures. However, I am now running into issues.

I have 11 .pngs (10 overlay with transparency and one base without transparency) that I wish to turn to textures. However, when adding them to a new or existing .dat, the program appears to not generate any mips at all; the new (or existing) .dat only contains the 128x128 versions of the textures. No exceptions appear. As I mentioned before, it worked for the first +/- 10 textures. On 64 bit Win 7 Enterprise. Tried fresh install, writing to new and existing .dats, adding only one texture at a time, etc.

Am I doing something wrong?  %confuso


Oh, and also, the drag/drop functionality does not seem to function for me. Not a big deal...I can just manually add the textures, but it may be worth looking into if you'd like.

Thanks so much.
Title: Re: Batch Png to Fsh tool
Post by: mgb204 on November 24, 2015, 09:01:45 PM
Underneath the window where your textures are listed is a drop down box. Make sure this has "Normal Mipmaps" selected, if it was changed it won't revert to the default when you close the application.
Title: Re: Batch Png to Fsh tool
Post by: nos.17 on November 24, 2015, 11:24:58 PM
Underneath the window where your textures are listed is a drop down box. Make sure this has "Normal Mipmaps" selected, if it was changed it won't revert to the default when you close the application.

It is and has been selected, so that shouldn't be the problem...must be something else.
Title: Re: Batch Png to Fsh tool
Post by: null45 on November 27, 2015, 05:41:30 PM
It is and has been selected, so that shouldn't be the problem...must be something else.

The texture instance id must end in 4, 9 or E in order for normal mipmaps to be generated.
The drag and drop bug has been fixed, file version updated to 1.5.3.2.
Title: Re: Batch Png to Fsh tool
Post by: null45 on July 19, 2016, 12:05:49 AM
Fixed a bug with PNG files always being detected as having transparency, file version updated to 1.5.4.0.
Title: Re: Batch Png to Fsh tool
Post by: null45 on August 27, 2017, 08:35:51 AM
Fixed a bug that would corrupt the DBPF compression directory when a dat contains existing files, file version updated to 1.5.5.0.
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 02:40:28 PM
Hello everyone,

I open the subject again because I downloaded the software but I have a problem. I want to create overlay textures for my future SNT mod, so when I drag my texture inside it (with the name ID code, for example: 0xF8DC4004).

I then create the texture, I open it with the Reader but the problem is that it is ultimately not an overley but a basic texture.

How should I proceed to create an overlay? I read the read-me, but there is nothing that speaks in depth about this subject.

Thank you in advance for your help.
Aka
Title: Re: Batch Png to Fsh tool
Post by: Andreas on October 22, 2017, 02:48:09 PM
My best guess: Your source file must have some transparent part, then it creates an overlay texture rather than a base texture. Use PNG as source format, as it supports transparency natively.
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 03:07:51 PM
I use the .PNG format. &mmm
I open the software and then open the texture I want to create (I only use the texture with the blue highlight):
(http://nsa39.casimages.com/img/2017/10/22/171022103456623262.jpg)

When the file is open in the software, I put these settings:
(http://nsa39.casimages.com/img/2017/10/22/171022103456818523.jpg)

Then I save the file that creates a .DAT (which I named Texture.dat). I open it with the Reader, and here is the result, a basic texture:
(http://nsa39.casimages.com/img/2017/10/22/171022103456987555.jpg)

Have I made a mistake somewhere?
Title: Re: Batch Png to Fsh tool
Post by: eggman121 on October 22, 2017, 03:14:32 PM
Hello Akallan

With PNG to FSH batch tool if you put a 4, 9 or e at the end of the texture it will make a scaled set.

This is to correspond with the different zoom levels in the game.

That is why you see some files with smaller sizes.

-eggman121
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 03:18:13 PM
Hello eggman, thank for your replies. The problem is not the small images, the problem is that the texture is not an overlay. I want to create overlays to be able to put the basic texture that we want below my roads.
Title: Re: Batch Png to Fsh tool
Post by: eggman121 on October 22, 2017, 04:06:41 PM
Hello eggman, thank for your replies. The problem is not the small images, the problem is that the texture is not an overlay. I want to create overlays to be able to put the basic texture that we want below my roads.

Ok. Now I know the problem. You need to change the Group ID from 0x1ABE787D to 0x0986135E

You should be able to use the textures for Lotting if you change this value.

-eggman121
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 04:12:37 PM
The problem is not gone. Despite the modification you suggest, when I create the texture it remains a basic texture. In the software settings I have to select something else?

Edit: An overlay texture should look like this in the Reader:
(http://nsa39.casimages.com/img/2017/10/22/171022114445643954.jpg)
Title: Re: Batch Png to Fsh tool
Post by: mgb204 on October 22, 2017, 04:25:19 PM
First off Eggman is correct, you need to be careful to use 0986135E, because the other group ID will prevent your textures from even appearing in the LE.

But the problem you have is really simple, you have an Alpha channel as a separate file, which this application can not read. So it sees the main PNG texture, which is filled with black and thinks (because no pixels are transparent) that you want to make a Base Texture. What you must do is remove this black part and save the PNG with transparency instead, a separate Alpha texture is not needed here.
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 04:30:46 PM
I put the ID that eggman advised me to put. You talk about transparency, but how can I create that? I think it's too easy to just think that we have to replace black with white unfortunately...  ()testing()
Title: Re: Batch Png to Fsh tool
Post by: Andreas on October 22, 2017, 05:00:38 PM
What program did you use to create the texture in the first place? You need to make sure that the black part around your road texture must show up as transparent (usually displayed as a white and grey checkerboard pattern in most programs) and then save the PNG file with transparency/alpha channel enabled. Since you have the transparent regions saved in a different image, you should be able use that in a mask layer in your graphics program.
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 05:06:57 PM
I created the textures with Paint. So no, there is no transparency ... That's one of the reasons I use SC4 Tool. But with SC4 Tool, when I put the ID with my range textures, the program refuses to create the texture:

(http://nsa39.casimages.com/img/2017/10/23/171023123453813594.jpg)

I sincerely believe that the textures do not want me! :crytissue:
Title: Re: Batch Png to Fsh tool
Post by: Andreas on October 22, 2017, 05:10:53 PM
Now you confuse me, you asked about the Batch Png to Fsh tool, and not SC4Tool. The latter won't work "out of the box", though, since you need to apply for a custom ID range first, and set up SC4Tool with that, otherwise, it would use some default ID range that collides with others if they do the same and upload their stuff.
Title: Re: Batch Png to Fsh tool
Post by: mgb204 on October 22, 2017, 05:12:08 PM
Well Paint is really limited in terms of what you can do. I'd highly recommend getting hold of and learning GIMP long term, it's going to make life so much easier.

Since you don't have the ability to save transparency in Paint, you'll need a work-around. SC4 Tool should do fine, but it wants the ID 0xF8DC4000, not ending in 4. Since as an application it works with 0, 5 & A instead of 4, 9 & E, which is the first instead of the last digit of the ID.
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 22, 2017, 05:20:11 PM
Excuse me Andreas, I do not want to discuss the SC4 Tool here, it was only to explain the situation in which I am.

Thanks for your explanation mgb204, I was able to create the overlay this way. I'm already using GIMP, but I'm bad when it comes to using tools (I think everyone noticed this), I use GIMP only for some stuff. But I will read tutorials and learn.

(http://nsa39.casimages.com/img/2017/10/23/171023124756703094.jpg)

Thank you all for your intervention, the software PngToFSH Batch works very well so, it's just me who follows an amateur!  :squirrel:
Title: Re: Batch Png to Fsh tool
Post by: null45 on October 22, 2017, 06:46:50 PM
But the problem you have is really simple, you have an Alpha channel as a separate file, which this application can not read. So it sees the main PNG texture, which is filled with black and thinks (because no pixels are transparent) that you want to make a Base Texture. What you must do is remove this black part and save the PNG with transparency instead, a separate Alpha texture is not needed here.

The PNG to FSH Batch tool can read the alpha channel from a separate file it just has to use _a after the filename.
In the example above the renaming the alpha channel from 0xF8DC4004-a0 to 0xF8DC4004_a would allow PNG to FSH Batch  to read it.
Title: Re: Batch Png to Fsh tool
Post by: mgb204 on October 23, 2017, 02:50:28 AM
In the example above the renaming the alpha channel from 0xF8DC4004-a0 to 0xF8DC4004_a would allow PNG to FSH Batch  to read it.

Good to know, thanks.
Title: Re: Batch Png to Fsh tool
Post by: Akallan on October 23, 2017, 04:58:48 AM
Great news, thank you for your help null45.
Title: Re: Batch Png to Fsh tool
Post by: Kitsune on October 23, 2017, 06:17:11 PM
How many files can I put in at once ? I ask because it keeps duplicating the id's, assigning x id to all zoom 4, y id to all zoom 5s etc when I put in multiple files. I have F8CC0010,F8CC002F in the instant range - a larger range I find just makes it pick random ids.

(http://glidingeagle.com/images/sc4/pngbatch.jpg)

Title: Re: Batch Png to Fsh tool
Post by: null45 on October 29, 2017, 09:29:55 AM
How many files can I put in at once ? I ask because it keeps duplicating the id's, assigning x id to all zoom 4, y id to all zoom 5s etc when I put in multiple files. I have F8CC0010,F8CC002F in the instant range - a larger range I find just makes it pick random ids.

The normal usage pattern for this tool is that the files are named using the instance ID that the texture should use.
For example if the texture should use 10b6000 as the instance id the input file should be named 0x10b6000.

As you have discovered if an instance id is not assigned via the texture name it will generate a random id without checking for duplicates.