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.

.imb/.pal files - Railroad Tycoon II

Featured Replies

  • Author
  • Localization

Bwolna, posted Sun Jun 26, 2022 1:02 pm (72311)


Something like this:

Code:
      Path sourceFile = Paths.get("/home/owner/test/RR2/PALT0504.PAL");
      byte[] rawFile = Files.readAllBytes(sourceFile);
      int count = readLong(rawFile, 0);
      for (int i=0; i         byte[] pal = new byte[768];
         for (int j=0; j<256; j ) {
            int color = readWord(rawFile, 4 0x23 i*512 j*2);
            int c1 = color & 0x1F;
            int c2 = (color >>> 5) & 0x1F;
            int c3 = (color >>> 0xA) & 0x1F;
            pal[j*3 0] = (byte) (c1 << 2);
            pal[j*3 1] = (byte) (c2 << 2);
            pal[j*3 2] = (byte) (c3 << 2);
         }
         Path newFile = Paths.get(sourceFile.toString() "." i ".pal");
         Files.write(newFile, pal,
               StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE);
      }
   }
}

If you know what picture could be used to find which of colors is red-green-blue, write here.
  • Author
  • Localization

eldomtom2, posted Sun Jun 26, 2022 3:38 pm (72317)


Here's BL1SHEEP.IMB in-game. Is this the sort of thing you're looking for?
  • Author
  • Localization

Bwolna, posted Sun Jun 26, 2022 4:24 pm (72318)


Code:
Extract sprites from BL1SHEEP.IMB
Number of sprites: 1
sprite #00
  sprite type 3
  Use palette PALT0239.PAL
  ...


Code:
Convert palettes from PALT0239.PAL
Number of palettes: 4
palette #00
  saved "/home/owner/test/RR2/2/PALT0239.PAL.palettes/00.pal"
palette #01
  saved "/home/owner/test/RR2/2/PALT0239.PAL.palettes/01.pal"
palette #02
  saved "/home/owner/test/RR2/2/PALT0239.PAL.palettes/02.pal"
palette #03
  saved "/home/owner/test/RR2/2/PALT0239.PAL.palettes/03.pal"


I don't how the game chooses one from these four palettes, but when I selected "00.pal" in GBS the image looks similar to your example. For other files you should try all extracted palettes to choose best match.

rr2pal.zip

  • Author
  • Localization

eldomtom2, posted Sun Jun 26, 2022 8:35 pm (72323)


That seems to work well, thanks a lot. I think the different palettes are for when you build buildings in the game. I'll let you know if I encounter any other problems.

Edit: My only comment is that it would be nice if you could support whatever 0x20 is.
  • Author
  • Localization

eldomtom2, posted Mon Jun 27, 2022 8:13 pm (72331)


I'm not sure if this helps, but I'm fairly certain the sprites that produce the "unpacking !0x20 not implemented" error are the ones with transparency.
  • Author
  • Localization

Bwolna, posted Sun Jul 17, 2022 5:23 pm (72629)


eldomtom2 wrote:
but I'm fairly certain the sprites that produce the "unpacking !0x20 not implemented" error are the ones with transparency.


Added !0x20 and 0x20 branches to sprite extractor tool.

Sprites with 0x20 are not used when game works in 16-bit mode, and I did not found anything meaningful encoded with this type of compression.

Contrary, !0x20 are used a lot for compressing animated parts of buildings and transparent parts of user interface.

OLD:
Code:
Sprite unpacker for Railroad Tycoon II

Extract sprites from YEAREND.IMB
Number of sprites: 8
sprite #00
  sprite type 3
  Use palette PALT0020.PAL
    block #00_00
      image #00_00_00
        image dimensions: 509x597
        ERROR: java.lang.Exception:         unpacking !0x20 not implemented!
...


NEW:
Code:
Sprite unpacker for Railroad Tycoon II, ver. 20220717

Extract sprites from YEAREND.IMB
Number of sprites: 8
sprite #00
  sprite type 3
  Use palette PALT0020.PAL
    block #00_00
      image #00_00_00
        image dimensions: 509x597
        image position: 12,0
        packed size: 242580, unpacked size: 303873
        saved "/home/owner/test/RR2/9/YEAREND.IMB.sprites/00_00_00.unpacked"
...

rr2spr2.zip

  • Author
  • Localization

eldomtom2, posted Thu Jul 21, 2022 3:34 pm (72700)


It works perfectly now, thanks a lot for all your hard work!
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.