[Tool] GD Stash

Shalie, Stormcaller, and Mamba,

How do y’all mofos have the picture icons? I’m willing to bet you didn’t screen cap everything, but instead figured out how to extract .tex files. Would you mind sharing that information (or the icons) with me, a person learning how to program, so I can use them to make a fancy webpage?

HOLY SHIT YOU’RE DOING THIS IN JAVA?!?!

Good job.

Edit: Eww, Card Layout. I don’t know why people like it so much other than convenience…never did like it relative to other alternatives. Yes, I can nitpick all day. :stuck_out_tongue:

Shalie, Stormcaller, and Mamba,

How do y’all mofos have the picture icons? I’m willing to bet you didn’t screen cap everything, but instead figured out how to extract .tex files. Would you mind sharing that information (or the icons) with me, a person learning how to program, so I can use them to make a fancy webpage?
Turns out .tex files are basically .dds files, as revealed in an earlier thread:

they are dds files and nvidia has a plugin for photoshop that works nice with it. note that dds editors are more like viewers so forget about editing :stuck_out_tongue: you will basically have to convert them to png at some point. remember to remove the alpha 1 channel, or the black parts of it.

I explained what I do here: http://www.grimdawn.com/forums/showpost.php?p=248049&postcount=15
and I think shalie just uses imagemagick instead, that program is something ridiculous(both in good and bad sense) so I bet it supports all this, if you learn it/already know it.

also on grimcalc stylesheet, some stuff(skills, itemskills, some other stuff, no items tho) alredy exist, so if you steal the css off of grimcalc, you can just write <div class=“class01-skillicon_shieldhammer1up”></div> and that would work…

icons exist as seperate images like so, if you know the filename:
http://grimcalc.com/i/sprite/class01/skillicon_battlefury2_up.png
http://grimcalc.com/i/sprite/class04/skillicon_bladetrap2down.png

then all these also exist as spritesheets:




and thats about it.

Thank you, this is what I was looking for :smiley:

Sure, the .tex are essentially slightly screwed up .dds files.

The first thing I do is read its header


  private static TEXHeader getTEXHeader(byte[] bytes) throws GDParseException  {
    TEXHeader header = new TEXHeader();
    
    header.version   = GDReader.getBytes4(bytes, 0);
    header.unknown   = GDReader.getUInt(bytes, 4);
    header.size      = GDReader.getUInt(bytes, 8);
    
    if ((header.version[3] != 2)) {
      throw new GDParseException("Version not supported.", 0);
    }
    
    return header;
  }

Then I throw away the .tex header (ie the first 12 bytes of the file) and use the header.size to determine how big the actual .dds is, i.e. is is the next ‘size’ bytes following after the 12. Generally speaking, that also should be identical to the remainder of the .tex file…

After that I extract the .dds header (that is a known format) and then fix the flags (found the logic for that in some TQ tools)

  private static void fixDDSHeader(byte[] bytes, DDSHeader header) {
    if (header.version[3] == DDSHeader.VERSION_REVERSED) {
      bytes[3] = DDSHeader.VERSION_DEFAULT;
    }
    
    int flags = header.flags            |
                DDSHeader.HEADER_CAPS   | 
                DDSHeader.HEADER_HEIGHT |
                DDSHeader.HEADER_DEPTH  |
                DDSHeader.HEADER_PIXELFORMAT;

    if (((( header.pixelFormat.flags & DDSPixelFormat.RGB )      == DDSPixelFormat.RGB)       ||
         (( header.pixelFormat.flags & DDSPixelFormat.YUV )      == DDSPixelFormat.YUV)       ||
         (( header.pixelFormat.flags & DDSPixelFormat.LUMINANCE) == DDSPixelFormat.LUMINANCE) ||
         (( header.pixelFormat.flags & DDSPixelFormat.ALPHA)     == DDSPixelFormat.ALPHA)) &&
        ( header.linearSize != 0)) {
      flags = flags | DDSHeader.HEADER_PITCH;
    }
    
    DDSLoader.writeBytes(bytes,   8, flags);
    
    DDSLoader.writeBytes(bytes,  92, DDSPixelFormat.R_BITMASK);
    DDSLoader.writeBytes(bytes,  96, DDSPixelFormat.G_BITMASK);
    DDSLoader.writeBytes(bytes, 100, DDSPixelFormat.B_BITMASK);
    
    int caps = header.caps | DDSHeader.CAPS_TEXTURE;
    DDSLoader.writeBytes(bytes, 108, caps);
  }

Finally, the constants used, they are from the .dds format, so also public knowledge


public class DDSPixelFormat {
    
  public static final int HEADER_SIZE = 32; // 8 * int

  public static final int ALPHA_PIXELS  = 0x01;
  public static final int ALPHA         = 0x02;
  public static final int FOUR_CC       = 0x04;
  public static final int PALETTE_IDX   = 0x0020;
  public static final int RGB           = 0x0040;
  public static final int YUV           = 0x0200;
  public static final int LUMINANCE     = 0x020000;
  
  public static final int R_BITMASK     = 0xFF0000;
  public static final int G_BITMASK     = 0x00FF00;
  public static final int B_BITMASK     = 0x0000FF;


public class DDSHeader {
    
  public static final int HEADER_SIZE = 92 + DDSPixelFormat.HEADER_SIZE; // 23 * int + 1 * pixel format
  
  public static final int VERSION_DEFAULT     = 0x20;
  public static final int VERSION_REVERSED    = 0x52;
  
  public static final int HEADER_CAPS         = 0x01;
  public static final int HEADER_HEIGHT       = 0x02;
  public static final int HEADER_WIDTH        = 0x04;
  public static final int HEADER_PITCH        = 0x08;
  public static final int HEADER_PIXELFORMAT  = 0x1000;
  public static final int HEADER_MIPMAP_COUNT = 0x2000;
  public static final int HEADER_LINEAR_SIZE  = 0x8000;
  public static final int HEADER_DEPTH        = 0x800000;

  public static final int CAPS_COMPLEX        = 0x08;
  public static final int CAPS_TEXTURE        = 0x1000;
  public static final int CAPS_MIPMAP         = 0x400000;
  
  public static final int CAPS2_CUBEMAP       = 0x0200;
  public static final int CAPS2_CUBE_POS_X    = 0x0400;
  public static final int CAPS2_CUBE_NEG_X    = 0x0800;
  public static final int CAPS2_CUBE_POS_Y    = 0x1000;
  public static final int CAPS2_CUBE_NEG_Y    = 0x2000;
  public static final int CAPS2_CUBE_POS_Z    = 0x4000;
  public static final int CAPS2_CUBE_NEG_Z    = 0x8000;
  public static final int CAPS2_VOLUME        = 0x020000;

After that, it is a regular .dds file, so any code that can read one will be able to read this too.

My only problem is the alpha channel, still have issues with that, so the background is black rather than transparent.

All the numbers are offsets within the byte array, e.g.

DDSLoader.writeBytes(bytes,  92, DDSPixelFormat.R_BITMASK);

writes DDSPixelFormat.R_BITMASK into the byte-array bytes at position 92.

why not ? :wink:

There is very little difference between C++, Java and C# etc., you can do it in any of them. I am no fan of C++, so that is out, C# is not something I ever really used, so that also is a slight hurdle (mostly to familiarize myself with the UI classes).

Edit: Eww, Card Layout. I don’t know why people like it so much other than convenience…never did like it relative to other alternatives. Yes, I can nitpick all day. :stuck_out_tongue:

seemed to make the most sense as there is no real order as to what page you should be on.

The alternative would be internal windows to me, but that seems overkill

mamba’s info on the file format looks good.

There are some existing tools from Titan Quest that still work with Grim Dawn , like TQ Texture Tools. Mostly work anyway, that one crashes on some .tex files :slight_smile:

That’s right! I was only joking about using Java :wink:

Looks really good. Cant wait for it to get released. Half the fun is in collecting the items :slight_smile:

Quick question: Will we be able to trade items between SC and HC chars too?

right now you still can, but I am probably considering that a bug :wink: (a small one, how much of an issue is that when you can simply create the item one tab away… I mostly want to have the option so people who want to play legit can easily do so)

Either that or have the user decide whether he wants to, after all it is trivial now too, just change the extension of the transfer file from .gst to .gsh

Looks good. Unfortunately, I doubt I’d ever use it since I try to keep Java off my machines.

Also, for database stuff, C# WinForms can use LocalDB, which is basically a single file SQL Server Express database without the need to install SQL Server Express. The only thing you’d need is the .NET Framework v4.0.2.

Hello mamba,

Sounds great! :slight_smile:

Have you any plans for a localisation? :wink:

The difference is that Java is the greatest, most vicious malware of our time. Please reconsider doing this in C#, it seems I’m not the only one who won’t install Java for anything.

Visual Studio + C# = success. It is by far the easiest and fastest solution for creating UIs I’ve ever seen. People at my work with zero background in programming are creating decent UIs with a few button clicks. The basic examples will teach you everything you need to know in a few hours. You won’t believe how easy it is until you try it.

Once again, please bury Java. Otherwise, looks great!

utter nonsense, leave that to Flash, ActiveX and others, Java does not even register on that scale

Visual Studio + C# = success. It is by far the easiest and fastest solution for creating UIs I’ve ever seen.

Haven’t touched that since the MFC, back then that was the worst UI classs set I ever had the misfortune to have to use. C# probably is a lot better, after all, they copied most of Java :wink:

I’m gonna have to agree with this. I’d rather have Java than Flash on my PC. lol

Thanks, haven’t really given that any thought.

The texts are all from items.txt and skills.txt so that probably already works (would have to look into whether you simply replace the english ones or configure the language somewhere, the latter then would need to be added).

The UI has very little text.

I intend to look into the former, not sure about the latter. So far I hadn’t thought about this, but now that you brought it up :wink:

Taking things literally (missing the point) and defending something bad by giving examples of something even worse. Ok, you win :slight_smile:

Thank you for doing this Mamba! May the gods (and Crate) smile upon your efforts and allow your hard work to bear fruit soon!

My mule situation is getting to be so burdensome that I was thinking of taking a break until the game was released and a tool like this appeared. So seriously, thank you! I only wish that I had the savvy to help.

OK, no problem!

Let’s see how it works, when it’s available.
(I hope soon!? :eek: :wink: )

I have been thinking about it a bit and there is more text in the program than just the buttons, eg for affixes which do not have one (blacksmiths) and for additional info, eg what damage types an affix deals (as eg of Spellweaving or whatever it is has all kinds of combinations of two magical damage types, so just having the name is not sufficient) or level as each affix exists in various tiers.

Would look strange if that were a mix, so I guess I have to work on that part too to make it international

I made the look & feel customizable. Now that I have seen the Java Windows L&F I find it positively ugly :wink:

Of the available ones I find Metal best with Nimbus (‘new’ in Java 7) a close second - I like it better if it weren’t for its Font :wink:

All others are just ugly to me, but now you can choose your favorite