Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Midnight Club: Street Racing (Ps2) .strtbl

Featured Replies

  • Author
  • Localization

ISKA, posted Tue Feb 04, 2020 10:14 am (53738)


I tried:
Rdr strtbl - swuforce
Midnight Club 3 DUB Edition Remix - Delutto
Doesn't work nothing.
  • Author
  • Localization

LokiReborn, posted Wed Feb 05, 2020 2:16 am (53760)


ISKA wrote:
I tried:
Rdr strtbl - swuforce
Midnight Club 3 DUB Edition Remix - Delutto
Doesn't work nothing.


Is this all you're trying to get at?

I just used the code below, the basic structure is count of offsets, followed by offsets. Some of them overlap assuming it's a lookup to a specific section used for something.
Then after that it's another count for string entries, followed by the entries themselves until the end of the file. The 8 bytes before the string I'm not sure if it's a hash or what the 8 after the string seem to always be 0000803F0000803F


Code:
OpenFileDialog OD = new OpenFileDialog();
if (OD.ShowDialog() == DialogResult.OK)
{
    FileStream fs = new FileStream(OD.FileName, FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    fs.Position = br.ReadInt32() * 4 4;

    int count = br.ReadInt32();
    List stringEntries = new List();

    for (int i = 0; i < count; i )
    {
        br.ReadInt64();
        string check = Encoding.Unicode.GetString(br.ReadBytes(br.ReadInt32() * 2));
        stringEntries.Add(check);
        br.ReadInt64();
    }

    File.WriteAllLines(OD.FileName ".txt", stringEntries);

    br.Close();
    fs.Close();
}
  • Author
  • Localization

ISKA, posted Wed Feb 05, 2020 7:52 am (53771)


LokiReborn wrote:
ISKA wrote:
I tried:
Rdr strtbl - swuforce
Midnight Club 3 DUB Edition Remix - Delutto
Doesn't work nothing.


Is this all you're trying to get at?

I just used the code below, the basic structure is count of offsets, followed by offsets. Some of them overlap assuming it's a lookup to a specific section used for something.
Then after that it's another count for string entries, followed by the entries themselves until the end of the file. The 8 bytes before the string I'm not sure if it's a hash or what the 8 after the string seem to always be 0000803F0000803F


Code:
OpenFileDialog OD = new OpenFileDialog();
if (OD.ShowDialog() == DialogResult.OK)
{
    FileStream fs = new FileStream(OD.FileName, FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    fs.Position = br.ReadInt32() * 4 4;

    int count = br.ReadInt32();
    List stringEntries = new List();

    for (int i = 0; i < count; i )
    {
        br.ReadInt64();
        string check = Encoding.Unicode.GetString(br.ReadBytes(br.ReadInt32() * 2));
        stringEntries.Add(check);
        br.ReadInt64();
    }

    File.WriteAllLines(OD.FileName ".txt", stringEntries);

    br.Close();
    fs.Close();
}


I just need unpack, edit and repack strtbl files.
  • Author
  • Localization

LokiReborn, posted Wed Feb 05, 2020 12:26 pm (53775)


ISKA wrote:
LokiReborn wrote:
ISKA wrote:
I tried:
Rdr strtbl - swuforce
Midnight Club 3 DUB Edition Remix - Delutto
Doesn't work nothing.


Is this all you're trying to get at?

I just used the code below, the basic structure is count of offsets, followed by offsets. Some of them overlap assuming it's a lookup to a specific section used for something.
Then after that it's another count for string entries, followed by the entries themselves until the end of the file. The 8 bytes before the string I'm not sure if it's a hash or what the 8 after the string seem to always be 0000803F0000803F


Code:
OpenFileDialog OD = new OpenFileDialog();
if (OD.ShowDialog() == DialogResult.OK)
{
    FileStream fs = new FileStream(OD.FileName, FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    fs.Position = br.ReadInt32() * 4 4;

    int count = br.ReadInt32();
    List stringEntries = new List();

    for (int i = 0; i < count; i )
    {
        br.ReadInt64();
        string check = Encoding.Unicode.GetString(br.ReadBytes(br.ReadInt32() * 2));
        stringEntries.Add(check);
        br.ReadInt64();
    }

    File.WriteAllLines(OD.FileName ".txt", stringEntries);

    br.Close();
    fs.Close();
}


I just need unpack, edit and repack strtbl files.


Okay going to take some tweaking, I missed a piece and know what the offsets at the start are.
Basically the game supports 10 languages, so the offsets at the start are the pointer to the table for each language. They reuse the same table for multiple languages so depending which language you want to edit depends on what strings you want to do (mind you I can't see if it lists 10 in game so it may only have 3 and it's just the file format supports 10)

From what I saw it seems like there are 6 unique language tables for in game and 7 of the 10 used. The one marked for reuse is Japanese which is weird but it is what it is.
  • Author
  • Localization

ISKA, posted Wed Feb 05, 2020 9:02 pm (53796)


LokiReborn wrote:
ISKA wrote:
LokiReborn wrote:

Is this all you're trying to get at?

I just used the code below, the basic structure is count of offsets, followed by offsets. Some of them overlap assuming it's a lookup to a specific section used for something.
Then after that it's another count for string entries, followed by the entries themselves until the end of the file. The 8 bytes before the string I'm not sure if it's a hash or what the 8 after the string seem to always be 0000803F0000803F


Code:
OpenFileDialog OD = new OpenFileDialog();
if (OD.ShowDialog() == DialogResult.OK)
{
    FileStream fs = new FileStream(OD.FileName, FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    fs.Position = br.ReadInt32() * 4 4;

    int count = br.ReadInt32();
    List stringEntries = new List();

    for (int i = 0; i < count; i )
    {
        br.ReadInt64();
        string check = Encoding.Unicode.GetString(br.ReadBytes(br.ReadInt32() * 2));
        stringEntries.Add(check);
        br.ReadInt64();
    }

    File.WriteAllLines(OD.FileName ".txt", stringEntries);

    br.Close();
    fs.Close();
}


I just need unpack, edit and repack strtbl files.


Okay going to take some tweaking, I missed a piece and know what the offsets at the start are.
Basically the game supports 10 languages, so the offsets at the start are the pointer to the table for each language. They reuse the same table for multiple languages so depending which language you want to edit depends on what strings you want to do (mind you I can't see if it lists 10 in game so it may only have 3 and it's just the file format supports 10)

From what I saw it seems like there are 6 unique language tables for in game and 7 of the 10 used. The one marked for reuse is Japanese which is weird but it is what it is.


These files for european version.
  • Author
  • Localization

LokiReborn, posted Wed Feb 05, 2020 9:23 pm (53797)


ISKA wrote:
LokiReborn wrote:
ISKA wrote:

I just need unpack, edit and repack strtbl files.


Okay going to take some tweaking, I missed a piece and know what the offsets at the start are.
Basically the game supports 10 languages, so the offsets at the start are the pointer to the table for each language. They reuse the same table for multiple languages so depending which language you want to edit depends on what strings you want to do (mind you I can't see if it lists 10 in game so it may only have 3 and it's just the file format supports 10)

From what I saw it seems like there are 6 unique language tables for in game and 7 of the 10 used. The one marked for reuse is Japanese which is weird but it is what it is.


These files for european version.


So it doesn't seem to like encoding the Japanese as Unicode and back and is screwing up the last entry. Since they're the last language in the list I just had it skip that one and use the original and not read it from the files. You should be able to pick any one of the other 5 languages and translate whichever you choose.

Midnight Club Street Racing.zip

  • Author
  • Localization

ISKA, posted Wed Feb 05, 2020 9:32 pm (53798)


LokiReborn wrote:
ISKA wrote:
LokiReborn wrote:

Okay going to take some tweaking, I missed a piece and know what the offsets at the start are.
Basically the game supports 10 languages, so the offsets at the start are the pointer to the table for each language. They reuse the same table for multiple languages so depending which language you want to edit depends on what strings you want to do (mind you I can't see if it lists 10 in game so it may only have 3 and it's just the file format supports 10)

From what I saw it seems like there are 6 unique language tables for in game and 7 of the 10 used. The one marked for reuse is Japanese which is weird but it is what it is.


These files for european version.


So it doesn't seem to like encoding the Japanese as Unicode and back and is screwing up the last entry. Since they're the last language in the list I just had it skip that one and use the original and not read it from the files. You should be able to pick any one of the other 5 languages and translate whichever you choose.

Thanks buddy. I will try and let you know.
  • Author
  • Localization

ISKA, posted Wed Feb 05, 2020 11:05 pm (53800)


ISKA wrote:
LokiReborn wrote:
ISKA wrote:

These files for european version.


So it doesn't seem to like encoding the Japanese as Unicode and back and is screwing up the last entry. Since they're the last language in the list I just had it skip that one and use the original and not read it from the files. You should be able to pick any one of the other 5 languages and translate whichever you choose.

Thanks buddy. I will try and let you know.


It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg
  • Author
  • Localization

LokiReborn, posted Thu Feb 06, 2020 12:04 pm (53806)


ISKA wrote:
ISKA wrote:
LokiReborn wrote:

So it doesn't seem to like encoding the Japanese as Unicode and back and is screwing up the last entry. Since they're the last language in the list I just had it skip that one and use the original and not read it from the files. You should be able to pick any one of the other 5 languages and translate whichever you choose.

Thanks buddy. I will try and let you know.


It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg


Personally no, like I said previously image formats aren't really my thing and I hate working with Glyphs and bitmap images. I feel for you I'm guessing you need to add cyrillic character glyphs? It's honestly why I stick to English translations for games because latin characters are always included.
  • Author
  • Localization

ISKA, posted Thu Feb 06, 2020 10:58 pm (53824)


LokiReborn wrote:
ISKA wrote:
ISKA wrote:
Thanks buddy. I will try and let you know.


It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg


Personally no, like I said previously image formats aren't really my thing and I hate working with Glyphs and bitmap images. I feel for you I'm guessing you need to add cyrillic character glyphs? It's honestly why I stick to English translations for games because latin characters are always included.

It's all right :)
  • Author
  • Localization

ISKA, posted Sun Feb 09, 2020 1:29 pm (53877)


LokiReborn wrote:
ISKA wrote:
ISKA wrote:
Thanks buddy. I will try and let you know.


It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg


Personally no, like I said previously image formats aren't really my thing and I hate working with Glyphs and bitmap images. I feel for you I'm guessing you need to add cyrillic character glyphs? It's honestly why I stick to English translations for games because latin characters are always included.


Hello again LokiReborn. Thanks for tool. I finished Midnight Club: Street Racing translation. I will planning to translate other midnigt clubs with release dates. If ? am not mistaken they used .strtbl files. in all midnight clubs. If I sent you to language files can you make a tool for these midnight club games.
  • Author
  • Localization

LokiReborn, posted Mon Feb 10, 2020 12:26 am (53895)


ISKA wrote:
LokiReborn wrote:
ISKA wrote:

It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg


Personally no, like I said previously image formats aren't really my thing and I hate working with Glyphs and bitmap images. I feel for you I'm guessing you need to add cyrillic character glyphs? It's honestly why I stick to English translations for games because latin characters are always included.


Hello again LokiReborn. Thanks for tool. I finished Midnight Club: Street Racing translation. I will planning to translate other midnigt clubs with release dates. If ? am not mistaken they used .strtbl files. in all midnight clubs. If I sent you to language files can you make a tool for these midnight club games.


Here ya go

Midnight Club Street Racing.zip

  • Author
  • Localization

ISKA, posted Mon Feb 10, 2020 8:41 am (53899)


LokiReborn wrote:
ISKA wrote:
LokiReborn wrote:

Personally no, like I said previously image formats aren't really my thing and I hate working with Glyphs and bitmap images. I feel for you I'm guessing you need to add cyrillic character glyphs? It's honestly why I stick to English translations for games because latin characters are always included.


Hello again LokiReborn. Thanks for tool. I finished Midnight Club: Street Racing translation. I will planning to translate other midnigt clubs with release dates. If ? am not mistaken they used .strtbl files. in all midnight clubs. If I sent you to language files can you make a tool for these midnight club games.


Here ya go

Hey, thanks buddy. You're a good friend. I'll never forget it.
  • Author
  • Localization

Allen, posted Tue Feb 11, 2020 8:05 am (53920)


ISKA wrote:
It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg


After receiving your PM, I did some research. This is a font image conversion plugin. Edit the picture and open it with NOESIS. Right-click and select "EXPORT" and find the .tex format for export.

Save it as "tex_angelstudios_tex.py" and put it in the "plugins/pyton" folder in Noesis.

Code:
# Midtown Madness / Midnight Club .TEX
# Font .tex Exporter: by Allen

# Tex Importer: by barti https://forum.xentax.com/viewtopic.php?t=12738&fbclid=IwAR3hmnYbavLryyVP9c53IGZPBHZXmhNHJs8jyGsdkabJOvtkBArjVXmCdHg#p105226
# Reference from http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
# and http://forum.xentax.com/viewtopic.php?f=10&p=9670

from inc_noesis import *

import noesis
import rapi

def registerNoesisTypes():
   handle = noesis.register("Midtown Madness / Midnight Club", ".tex")
   noesis.setHandlerTypeCheck(handle, texCheckType)
   noesis.setHandlerLoadRGBA(handle, texLoadRGBA)
   noesis.setHandlerWriteRGBA(handle, texWriteRGBA)
   return 1

def texCheckType(data):
   return 1

def texLoadRGBA(data, texList):
   tex = AGETexture(NoeBitStream(data))
   texList.append(tex.parseTexture())
   return 1

class AGETexture:

   def __init__(self, reader):
      self.reader = reader

   def parseTexture(self):
      texWidth   = self.reader.readUShort()
      texHeight  = self.reader.readUShort()
      texType    = self.reader.readShort()
      texMips    = self.reader.readShort()
      texUnknown = self.reader.readShort()
      texFlag1   = self.reader.readUByte()
      texFlag2   = self.reader.readUByte()
      texFlag3   = self.reader.readUByte()
      texFlag4   = self.reader.readUByte()
            
      if texType == 1: # P8
         palMap = self.reader.readBytes(256*4)
         pixMap = self.reader.readBytes(texWidth * texHeight)
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 8, "b8g8r8p8")
      if texType == 14: # PA8
         palMap = self.reader.readBytes(256*4)
         pixMap = self.reader.readBytes(texWidth * texHeight)
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 8, "b8g8r8a8")
      if texType == 15: # P4_MC
         palMap = self.reader.readBytes(16*4)
         pixMap = self.reader.readBytes(int(texWidth * texHeight / 2))
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 4, "b8g8r8p8")
      if texType == 16: # PA4_MC
         palMap = self.reader.readBytes(16*4)
         pixMap = self.reader.readBytes(int(texWidth * texHeight / 2))
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 4, "b8g8r8a8")
      if texType == 17: # RGB888
         pixMap = self.reader.readBytes(texWidth * texHeight * 3)
         pixData = rapi.imageDecodeRaw(pixMap, texWidth, texHeight, "r8g8b8")
      if texType == 18: # RGBA8888
         pixMap = self.reader.readBytes(texWidth * texHeight * 4)
         pixData = rapi.imageDecodeRaw(pixMap, texWidth, texHeight, "r8g8b8a8")
      # Midnight Club 2 support (textype 26 not fully functional)
      if texType == 22: # DXT1
         pixMap = self.reader.readBytes(int(texWidth * texHeight * 4 / 8))
         pixData = rapi.imageDecodeDXT(pixMap, texWidth, texHeight, noesis.NOESISTEX_DXT1)
      if texType == 26: # DXT5
         pixMap = self.reader.readBytes(int(texWidth * texHeight * 4 / 4))
         pixData = rapi.imageDecodeDXT(pixMap, texWidth, texHeight, noesis.NOESISTEX_DXT5)
         
      #pixData = rapi.imageFlipRGBA32(pixData, texWidth, texHeight, 0, 1)
      return NoeTexture("tex", texWidth, texHeight, pixData, noesis.NOESISTEX_RGBA32)
   
def texWriteRGBA(data, width, height, bs):
        bs.writeShort(width)
        bs.writeShort(height)
        bs.writeShort(16)
        bs.writeShort(1)
        bs.writeShort(0)
        bs.writeByte(1)
        bs.writeByte(0)
        bs.writeByte(1)       
        bs.writeByte(0)       
        imgPix = rapi.imageResample(data, width, height, width, height)
        imgPal = rapi.imageGetPalette(imgPix, width, height, 16, 0, 1)
        idxPix = rapi.imageApplyPalette(imgPix, width, height, imgPal, 16)

        #bgra 32bpp palette
        for i in range(0,16):
                bs.writeUByte(imgPal[i*4 2])
                bs.writeUByte(imgPal[i*4 1])
                bs.writeUByte(imgPal[i*4 0])
                bs.writeUByte(imgPal[i*4 3])
        #4bpp indexed palette image       
        for i in range(width*height//2):
                idx2 = idxPix[i*2 0]
                idx1 = idxPix[i*2 1]
                idx = ((idx1 << 4) | idx2) & 0xff
                bs.writeUByte(idx)
        return 1
  • Author
  • Localization

ISKA, posted Tue Feb 11, 2020 10:16 pm (53935)


Allen wrote:
ISKA wrote:
It worked. I have another question. Actually last question. I need to edit font files to completely translating for my language. I guess .tex file entensions actually font files and they are in different places. I will send the some examples. Would you help me about this?
http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
http://forum.mm2c.com/viewtopic.php?t=1 ... d9f080313c

This noesis script export fonts but maybe can't support import.
https://forum.xentax.com/viewtopic.php? ... ArjVXmCdHg


After receiving your PM, I did some research. This is a font image conversion plugin. Edit the picture and open it with NOESIS. Right-click and select "EXPORT" and find the .tex format for export.

Save it as "tex_angelstudios_tex.py" and put it in the "plugins/pyton" folder in Noesis.

Code:
# Midtown Madness / Midnight Club .TEX
# Font .tex Exporter: by Allen

# Tex Importer: by barti https://forum.xentax.com/viewtopic.php?t=12738&fbclid=IwAR3hmnYbavLryyVP9c53IGZPBHZXmhNHJs8jyGsdkabJOvtkBArjVXmCdHg#p105226
# Reference from http://mm2kiwi.apan.is-a-geek.com/index.php?title=TEX
# and http://forum.xentax.com/viewtopic.php?f=10&p=9670

from inc_noesis import *

import noesis
import rapi

def registerNoesisTypes():
   handle = noesis.register("Midtown Madness / Midnight Club", ".tex")
   noesis.setHandlerTypeCheck(handle, texCheckType)
   noesis.setHandlerLoadRGBA(handle, texLoadRGBA)
   noesis.setHandlerWriteRGBA(handle, texWriteRGBA)
   return 1

def texCheckType(data):
   return 1

def texLoadRGBA(data, texList):
   tex = AGETexture(NoeBitStream(data))
   texList.append(tex.parseTexture())
   return 1

class AGETexture:

   def __init__(self, reader):
      self.reader = reader

   def parseTexture(self):
      texWidth   = self.reader.readUShort()
      texHeight  = self.reader.readUShort()
      texType    = self.reader.readShort()
      texMips    = self.reader.readShort()
      texUnknown = self.reader.readShort()
      texFlag1   = self.reader.readUByte()
      texFlag2   = self.reader.readUByte()
      texFlag3   = self.reader.readUByte()
      texFlag4   = self.reader.readUByte()
            
      if texType == 1: # P8
         palMap = self.reader.readBytes(256*4)
         pixMap = self.reader.readBytes(texWidth * texHeight)
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 8, "b8g8r8p8")
      if texType == 14: # PA8
         palMap = self.reader.readBytes(256*4)
         pixMap = self.reader.readBytes(texWidth * texHeight)
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 8, "b8g8r8a8")
      if texType == 15: # P4_MC
         palMap = self.reader.readBytes(16*4)
         pixMap = self.reader.readBytes(int(texWidth * texHeight / 2))
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 4, "b8g8r8p8")
      if texType == 16: # PA4_MC
         palMap = self.reader.readBytes(16*4)
         pixMap = self.reader.readBytes(int(texWidth * texHeight / 2))
         pixData = rapi.imageDecodeRawPal(pixMap, palMap, texWidth, texHeight, 4, "b8g8r8a8")
      if texType == 17: # RGB888
         pixMap = self.reader.readBytes(texWidth * texHeight * 3)
         pixData = rapi.imageDecodeRaw(pixMap, texWidth, texHeight, "r8g8b8")
      if texType == 18: # RGBA8888
         pixMap = self.reader.readBytes(texWidth * texHeight * 4)
         pixData = rapi.imageDecodeRaw(pixMap, texWidth, texHeight, "r8g8b8a8")
      # Midnight Club 2 support (textype 26 not fully functional)
      if texType == 22: # DXT1
         pixMap = self.reader.readBytes(int(texWidth * texHeight * 4 / 8))
         pixData = rapi.imageDecodeDXT(pixMap, texWidth, texHeight, noesis.NOESISTEX_DXT1)
      if texType == 26: # DXT5
         pixMap = self.reader.readBytes(int(texWidth * texHeight * 4 / 4))
         pixData = rapi.imageDecodeDXT(pixMap, texWidth, texHeight, noesis.NOESISTEX_DXT5)
         
      #pixData = rapi.imageFlipRGBA32(pixData, texWidth, texHeight, 0, 1)
      return NoeTexture("tex", texWidth, texHeight, pixData, noesis.NOESISTEX_RGBA32)
   
def texWriteRGBA(data, width, height, bs):
        bs.writeShort(width)
        bs.writeShort(height)
        bs.writeShort(16)
        bs.writeShort(1)
        bs.writeShort(0)
        bs.writeByte(1)
        bs.writeByte(0)
        bs.writeByte(1)       
        bs.writeByte(0)       
        imgPix = rapi.imageResample(data, width, height, width, height)
        imgPal = rapi.imageGetPalette(imgPix, width, height, 16, 0, 1)
        idxPix = rapi.imageApplyPalette(imgPix, width, height, imgPal, 16)

        #bgra 32bpp palette
        for i in range(0,16):
                bs.writeUByte(imgPal[i*4 2])
                bs.writeUByte(imgPal[i*4 1])
                bs.writeUByte(imgPal[i*4 0])
                bs.writeUByte(imgPal[i*4 3])
        #4bpp indexed palette image       
        for i in range(width*height//2):
                idx2 = idxPix[i*2 0]
                idx1 = idxPix[i*2 1]
                idx = ((idx1 << 4) | idx2) & 0xff
                bs.writeUByte(idx)
        return 1


Thanks Allen. It's worked.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.