ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Thu Apr 26, 2018 7:52 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Freedom Fighters .LOC
PostPosted: Thu Dec 21, 2017 8:41 am 
User avatar

Joined: Sun Aug 17, 2014 7:27 pm
Posts: 1017
Image
Image

Maybe this tool to help https://github.com/x1nixmzeng/KaneLynchLoc or https://github.com/x1nixmzeng/Hitman2Loc?
Code:
//--------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File:       kl_loc.bt
// Author:     x1nixmzeng/WRS
// Revision:   1
// Purpose:    KaneAndLynch LOC files
//--------------------------------------

//////////////////////////////////////////////
#include "prelen.bt"
//////////////////////////////////////////////

//////////////////////////////////////////////
// **uncomment to dump to tty window**
//#define DUMP_PLAINTEXT
//////////////////////////////////////////////

enum <uchar> t
{
  tempty = 0x8, //
  tenum = 0x9,  // ?
  tlist = 0x10, //
  tint = 0x28,  //
  tstr = 0x29,  //
};

// hack to get credits output correctly
void PrintString(str &s, int chk)
{
  local int i=0;
  while( (s.len-i) > chk ) {
    Printf("%s", SubStr(s.val,i,chk));
    i+=chk;
  }
  Printf("%s", SubStr(s.val,i));
}

struct node;
struct node(int max_size)
{
  local uint cur_size = 0;

  Assert(max_size > 0); //sanity

  // string
  str _str(pnt);
  cur_size += _str.len +1;


#ifdef DUMP_PLAINTEXT
  Printf("\"%s\"", _str.val);
#endif

  if( cur_size < max_size )
  {

  t type;
  cur_size += sizeof(t);

  switch(type)
  {
  case tlist:
  {
    // item count
    uchar cnt;
    cur_size += 1;

#ifdef DUMP_PLAINTEXT
    Printf(" [\n");
#endif

    if( cnt > 0 )
    {
      if( cnt > 1 )
      {
        // item sizes
        uint flags[cnt-1];
        cur_size += sizeof(uint) * (cnt-1);
   
        local int i; local int last = 0;
        for(i=0;i<cnt-1;++i)
        {
          node child(flags[i]-last);
          cur_size += child.cur_size;
          last = flags[i];
        }
      } // cnt > 1
   
      Assert(max_size > cur_size);
   
      node child(max_size-cur_size);
      cur_size += child.cur_size;
    }

#ifdef DUMP_PLAINTEXT
    Printf("]");
#endif

    break;
  }
  case tint:
  {
    // odd edgecase. expected int but it's been removed
    if( cur_size == max_size )
    {
#ifdef DUMP_PLAINTEXT
    Printf(" 0"); // assuming zero
#endif
    } else {
      int val;
      cur_size += 4;
#ifdef DUMP_PLAINTEXT
      Printf(" %i", val);
#endif
    }
    break;
  }
  case tstr:
  {
    str ntstr(pnt);
#ifdef DUMP_PLAINTEXT
    Printf(" = \"");
    PrintString(ntstr,512);
    Printf("\"");
#endif
    cur_size += ntstr.len +1;
    break;
  }
  case tenum:
  {
    str ntstr(pnt);
#ifdef DUMP_PLAINTEXT
    Printf(" = \"");
    PrintString(ntstr,512);
    Printf("\"");
#endif
    cur_size += ntstr.len +1;

    uint unknown;
    cur_size += sizeof(uint); Assert(unknown==0);

    break;
  }
}

  local uint pad = max_size-cur_size;
  if( pad != 0 )
  {
    Assert((pad&3)==0); // aligned to 4 bytes

    int other[pad>>2];
    cur_size = max_size;
#ifdef DUMP_PLAINTEXT
    local int j;
    for(j=0;j<pad>>2;++j)Printf(" %i", other[j]);
    Printf("\n");
#endif
  }

#ifdef DUMP_PLAINTEXT
  else
  {
    Printf("\n");
  }
#endif
 }

};

//////////////////////////////////////////////
// Entry point

node root(FileSize());
Assert(FEof());

//////////////////////////////////////////////


Attachments:
.LOC Files.rar [1.44 MiB]
Downloaded 29 times
Top
   
PostPosted: Tue Dec 26, 2017 10:41 am 

Joined: Thu Oct 16, 2014 4:39 pm
Posts: 166
Try Elbereth's loctool.
https://download.elberethzone.net/hmc/

_________________
Texttool sources: viewtopic.php?f=12&t=645


Top
   
PostPosted: Wed Dec 27, 2017 7:58 pm 
User avatar

Joined: Sun Aug 17, 2014 7:27 pm
Posts: 1017
Thanks!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited