Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat

Author Topic: Simple FSH<>PNG Tools  (Read 27829 times)

0 Members and 1 Guest are viewing this topic.

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Simple FSH<>PNG Tools
« on: March 02, 2009, 02:11:11 PM »
I don't know if it's useful to anyone else, but I made it because other FSH Tools took to long, when I just quickly wanted to Convert FSH to BMP,
Just open the FSH with the Tool you get 3 buttons Bitmap Only, Bitmap and Alpha and Alpha Only, click what you want and the BMP appears almost immediately in the same location as the FSH file with the same name.
If anyone's interested post and then download the program in the attachment(includes Vista FSHLib.dll(should work on non Vista) :)



Jonathan

Offline TheTeaCat

Re: Simple FSH to BMP tool
« Reply #1 on: March 02, 2009, 02:26:34 PM »
Ohh a clever sounding little tool &apls
I'd be interested ::)

 :satisfied:
TTC
Kettle's on. Milk? Sugars?    ps I don't like Earl Grey  $%Grinno$%
Reduce, Reuse, Recycle - If you're not part of the solution , you're part of the problem!
"Never knock on Death's door: Ring the bell and run away! Death really hates that!"
Tales at TeaTime      Now A proper NUT      TTC plays GRV II

Offline Ennedi

Re: Simple FSH to BMP tool
« Reply #2 on: March 02, 2009, 02:36:44 PM »
Very nice, I would be interested too  :thumbsup:
New Horizons Productions
Berethor - beskhu3epnm - blade2k5 - dmscopio - dedgren - Emilin - Ennedi
jplumbley - moganite - M4346 - nichter85 - papab2000 - Shadow Assassin - Tarkus - wouanagaine

Offline Andreas

  • Administrator
  • Forums Legend
  • *
  • Posts: 4769
  • Total likes: 978
  • Reputation: 33
    • SimCityPlaza
  • CL: ()bobby() Transit Controller
Re: Simple FSH to BMP tool
« Reply #3 on: March 02, 2009, 02:43:25 PM »
Cool. How does that work? Do you simply have to drag the FSH file onto the program window to open it, or do you have to select the file via a menu/dialogue? What about making those buttons a "hotspot" where you can drag the FSH onto, and it will be converted immediately?
Andreas

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: Simple FSH to BMP tool
« Reply #4 on: March 02, 2009, 02:53:38 PM »
I'll just attach to the post :)
btw, it includes the Vista FSHLib.dll, but I'm not 100% sure if it works on XP.

You have to open the the FSH with the program, so like either set it as the default program or right click, open with, FSH To BMP.

But you can't open the program directly and then open the FSH File.
Hotspots is an idea, I'll try making that but I think it will be beyond my programming knowledge :)

Jonathan

Offline Rayden

  • BSC Team
  • Forums Parliamentarian
  • *
  • Posts: 1261
  • Total likes: 1
  • Reputation: 13
  • Call me Silvio
  • CL: ()CaMsTeR()
Re: Simple FSH to BMP tool
« Reply #5 on: March 02, 2009, 03:04:49 PM »
Thx Jonathan :thumbsup:

Offline Andreas

  • Administrator
  • Forums Legend
  • *
  • Posts: 4769
  • Total likes: 978
  • Reputation: 33
    • SimCityPlaza
  • CL: ()bobby() Transit Controller
Re: Simple FSH to BMP tool
« Reply #6 on: March 02, 2009, 03:21:34 PM »
Hotspots is an idea, I'll try making that but I think it will be beyond my programming knowledge :)

Well, any programming knowledge is beyond me, so I have no idea how complicated that could be. All I know is that such programs do exist (i. e. for converting audio files), and for converting FSH files, it seem to be a nice trick. Assigning the FSH files to your program and opening them via double-click is pretty much as fast as well, though, so there's no need to dig any further. :)
Andreas

Offline wouanagaine

  • NHP Team
  • Forums Guru
  • *
  • Posts: 2854
  • Total likes: 7
  • Reputation: 43
  • CL: :computer: SC4 CodeMaster
Re: Simple FSH to BMP tool
« Reply #7 on: March 02, 2009, 03:36:22 PM »
Nice to see more and more programmers are in :)
good job  :thumbsup:
New Horizons Productions
Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio ♦ dedgren ♦ emilin ♦ Ennedi ♦ Heblem ♦ jplumbley
M4346 ♦ moganite ♦ Papab2000 ♦ Shadow Assassin ♦ Tarkus ♦ wouanagaine
Divide wouanagaine by zero and you will in fact get one...one bad-ass that is - Alek King of SC4

Offline sithlrd98

Re: Simple FSH to BMP tool
« Reply #8 on: March 02, 2009, 05:51:30 PM »
 :thumbsup: Great job Jonathan! Works as advertised (in Vista at least)! I am amazed constantly amazed  by all the things that get produced for this game!

Jayson

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Simple FSH to BMP tool
« Reply #9 on: March 02, 2009, 07:50:58 PM »
Works on WinXP.

It should work on Win98 or newer   :P


The vista friendly version should now have its own version number, to tell it apart from the non vista friendly versions.

The new FSHLib vista version: http://sc4devotion.com/forums/index.php?topic=5142.msg221467#msg221467


Any chance the vista friendly version can be uploaded to the LEX?

« Last Edit: March 02, 2009, 08:30:54 PM by null45 »

Offline JoeST

  • Forums Guru
  • *
  • Posts: 2648
  • Total likes: 15
  • Reputation: 10
  • fbstj
  • CL: Not your average...
Re: Simple FSH to BMP tool
« Reply #10 on: March 03, 2009, 04:02:48 AM »
awesome that your programming Jon :)

any chance of the code? :D

Joe
Copperminds and Cuddleswarms

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: Simple FSH to BMP tool
« Reply #11 on: March 03, 2009, 11:16:50 AM »
Joe, We'll its the first thing I made I actually find useful ;)

Yep I could it's quite short (and probably not written in the best way), and its VB  :)

Jonathan

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Simple FSH to BMP tool
« Reply #12 on: March 04, 2009, 10:02:14 PM »
Buttons that are "hotspot" meaning you can drag & drop files onto them are fairly easy to make when using the AllowDrop file property in the Visual Studio designer.  ;)

In an demo I made the only purpose of the buttons was to drop fsh files to convert onto.  :thumbsup:

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: Simple FSH to BMP tool
« Reply #13 on: March 05, 2009, 01:03:27 AM »
I got the dropping to work, but didn't know how to get the DropData into a Stream, and couldn't find anything about it anywhere, so I kind of gave up :)

Jonathan

Offline superhands

  • NAM Team
  • Forums Senator
  • *
  • Posts: 928
  • Total likes: 1
  • Reputation: 12
  • was bighead99
    • f u t u r e  p e r t h
  • CL: One Track Mind
Re: Simple FSH to BMP tool
« Reply #14 on: March 05, 2009, 01:13:50 AM »
nice work jon.  ;D

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Simple FSH to BMP tool
« Reply #15 on: March 05, 2009, 08:22:33 AM »
if it helps the code that i used for dropping is:

Code: [Select]
   private void button2_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

            foreach (string file in files)
            {
                FileInfo fi = new FileInfo(file);
                if (fi.Exists)
                {
                    if (fi.Extension.Equals(".fsh"))
                    {
                        FSHImage fsh = new FSHImage();
                        BitmapItem bi = new BitmapItem();
                        FileStream fstream = new FileStream(fi.FullName, FileMode.Open);

                        string path = Path.GetDirectoryName(Application.ExecutablePath);
                        fsh.Load(fstream);
                        bi = (BitmapItem)fsh.Bitmaps[0];

                        bi.Bitmap.Save(Path.Combine(path, Path.GetFileNameWithoutExtension(fi.FullName) + ".png"), ImageFormat.Png);
                        bi.Alpha.Save(Path.Combine(path, Path.GetFileNameWithoutExtension(fi.FullName) + "_a.png"), ImageFormat.Png);
                    }
                }
               
            }

        }

Offline dedgren

Re: Simple FSH to BMP tool
« Reply #16 on: March 05, 2009, 09:45:02 AM »
Folks, I'm getting a "This is not a valid BMP/DIB/RLE file." message in PSP when I try to open the files that are output.  Everything else appears to work as described.  I run 64-bit Vista.


David
D. Edgren

Please call me David...

Three Rivers Region- A collaborative development of the SC4 community
The 3RR Quick Finder [linkie]


I aten’t dead.  —  R.I.P. Granny Weatherwax

Skype: davidredgren

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: Simple FSH to BMP tool
« Reply #17 on: March 05, 2009, 11:15:09 AM »
I tried it in paint and GIMP and paint and it works, could you try it in one of them as well?

Jonathan

Offline sithlrd98

Re: Simple FSH to BMP tool
« Reply #18 on: March 05, 2009, 12:23:57 PM »
That is strange,I get the same error in PSP8,Photoshop CS2 gives "could not complete your request because the file-format module cannot parse the file".
I also am on Vista 64 , the Windows photo gallery does open the file though.

Jayson


Offline cogeo

  • NAM Team
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: Simple FSH to BMP tool
« Reply #19 on: March 05, 2009, 12:40:05 PM »
I could make a new FSH->BMP tool in the weekend. It should have a batch FSH->BMP function too.

Warior, do you have any documentation of this dll (functions, arguments, description etc), and an import library? How did you know what is available in there?