:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Thu Sep 20, 2018 10:32 am
All times are UTC + 0
 Forum index » Featured Tools » Community Tools
Westwood PAL to photoshop ACT converter
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Author Message
Katz
Disk Thrower


Joined: 01 Sep 2007
Location: Russia, Katzburg

PostPosted: Sat Jan 13, 2018 5:35 pm    Post subject:  Westwood PAL to photoshop ACT converter Reply with quote

Westwood PAL palette to photoshop ACT palette converter.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace westwoodPALtoACT
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Westwood PAL to Photoshop ACT converter\n");
                Console.WriteLine("Usage: westwoodPALtoACT.exe westwood.pal\n");
                Console.WriteLine("westwoodPALtoACT.exe westwood.pal");
                return;
            }
            if (args != null && args.Length > 0)
            {
                if (File.Exists(args[0]))
                {
                    string ACTfile = Path.GetFileNameWithoutExtension(args[0])+ ".act";
                    Console.WriteLine("Output file: " + ACTfile);
                    using (MemoryStream palette = new MemoryStream(File.ReadAllBytes(args[0])))
                    {

                        using (BinaryReader reader = new BinaryReader(palette))
                        {
                            FileStream act = File.Create(ACTfile, 768, FileOptions.None);
                            using (BinaryWriter writer = new BinaryWriter(act))
                            {
                                for (int i = 0; i < 256; i++)
                                {
                                    byte r = (byte)(reader.ReadByte() << 2);
                                    byte g = (byte)(reader.ReadByte() << 2);
                                    byte b = (byte)(reader.ReadByte() << 2);
                                    byte[] color = new byte[3] {r,g,b};
                                    writer.Write(color);
                                }
                                writer.Close();
                            }
                            reader.Close();
                        }
                    }
                }
            }
        }
    }
}



ps_act.png
 Description:
 Filesize:  28.59 KB
 Viewed:  476 Time(s)

ps_act.png



westwoodPALtoACT.png
 Description:
 Filesize:  25.88 KB
 Viewed:  476 Time(s)

westwoodPALtoACT.png



westwoodPALtoACT.zip
 Description:

Download
 Filename:  westwoodPALtoACT.zip
 Filesize:  16.2 KB
 Downloaded:  8 Time(s)


_________________
Everything not saved will be lost. :3

Back to top
View user's profile Send private message ModDB Profile ID Skype Account
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
 Forum index » Featured Tools » Community Tools
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only one of the following words: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.1099s ][ Queries: 16 (0.0054s) ][ Debug on ]