Modding discussion for Driver 2.
By Krishty
Registration Days Posts Posts Posts
#50310
A texture from Driver 2:
MPLAYER CHICAGO LEV atlas 0012E000.png
I now know where the palettes are stored, and how indexed color data accesses those palettes. I do not know yet, however, how to build a complete texture index of a level. This is why I could only extract this single texture — it looks unique on the bottom right and I could therefore easily determine what data is linked to it.
You do not have the required permissions to view the files attached to this post.
User avatar
By RacingFreak
#50313
This is so sweet! Big bravo, Krishty, maybe we will finally see the Driver 2 models (and possible hidden textures we couldnt load else?)! CARRY ON :specialdriver:
By Krishty
Registration Days Posts Posts Posts
#50351
Still no idea on the exact association of the texture index with the data in the file. I can hear you screaming, "Where are the car textures?" – those seem to be compressed; it'll take a little reverse engineering to see whether it's just simple RLE or something more complicated like LZ. In the meantime, more building textures:

Image

Image

Image
User avatar
By Fireboyd78
#50357
Nice work! Maybe with enough of your research, we could put some Driver 2 tools into DSCript!
By Krishty
Registration Days Posts Posts Posts
#50667
A few words on how to get these textures:

Consider the first post of this thread: You see the 00000022 lump there. It contains a list of texture atlas names, and a list of textures per atlas. For each texture on an atlas, you see this structure:
Code: Select all
2-B integer with unknown meaning
2-B integer with offset of the texture name in the previous lump
two 1-B integers giving the origin of the texture on the atlas, in pixels
two 1-B integers giving the dimensions of the texture on the atlas, in pixels, where 0 means 256.
This data is required to resolve texture palettes.

For MLEVELS\CHICAGO.LEV (the file I analyzed most of the time), the texture list looks like (unused entries stripped):
Code: Select all
[0] 0001 0000 00001F98
[1] 0001 0000 000093A0
[2] 0001 0000 00010C90
[3] 0002 0000 000178EC
[4] 0002 0000 0001EC60
[5] 0002 0000 00025ED0
[6] 0002 0000 0002D760
[7] 0002 0000 00035340
[8] 0002 0000 0003C944
[9] 0002 0000 00043C44
[10] 0002 0000 0004AC40
[11] 0002 0000 0005234C
[12] 0002 0000 000594F0
[13] 0002 0000 00060E6C
[14] 0002 0000 00067A60
[15] 0002 0000 0006E7B8
[16] 0002 0000 00075B20
[17] 0002 0000 0007C664
[18] 0002 0000 00083C70
[19] 0002 0000 0008AF14
[20] 0002 0000 000921A0
[21] 0002 0000 00099774
[22] 0002 0000 000A038C
[23] 0002 0000 000A4F24
[24] 0002 0000 000AC534
[25] 0002 0000 000B3EC0
[26] 0002 0000 000BB810
[27] 0002 0000 000C2748
[28] 0002 0000 000C95D4
[29] 0002 0000 000D0280
[30] 0002 0000 000D708C
[31] 0002 0000 000DE5AC
[32] 0002 0000 000E4C04
[33] 0002 0000 000E7D00
[34] 0002 0000 000EF008
[35] 0002 0000 000F67E4
[36] 0002 0000 000FE1B0
[37] 0002 0000 00105B78
[38] 0002 0000 0010C7C4
[39] 0002 0000 00113294
[40] 0002 0000 0011A4F0
[41] 0002 0000 00121E60
[42] 0002 0000 001293AC
[43] 0002 0000 00130214
[44] 0002 0000 001370D0
[45] 0002 0000 0013E420
[46] 0002 0000 00142DC8
[47] 0002 0000 00142FD4
[48] 0001 0000 001431E0
[49] 0002 0000 00149ED8
[50] 0001 0000 0014A0E4
[51] 0001 0000 00150A00
[52] 0001 0000 00156B40
[53] 0002 0000 0015D8AC
[54] 0004 0000 00163714
[55] 0004 0000 0016A9D8
[56] 0004 0000 001701D0
[57] 0004 0000 0017676C
[58] 0001 0000 0017B400
[59] 0002 0000 00181ED0
[60] 0002 0000 001899B4
[61] 0004 0000 0018AF18
[62] 0001 0000 00191304
[63] 0001 0000 00197AD0
[64] 0004 0000 0019DE4C
[65] 0001 0000 001A3370
[66] 0004 0000 001A9EAC
[67] 0004 0000 001B0234
[68] 0004 0000 001B54C0
[69] 0004 0000 001BBF74
*unused*
[00] 0000001E|286F 0000 00/00 40x18|23B2 0004 40/00 20x40|28CF 000C A0/00 40x20|6841 0014 E3/04 14x30|23A2 001B 00/58 40x40|2565 0021 80/78 80x08|6963 0026 80/40 20x22|286E 002A 00/98 40x20|28D0 0032 00/B8 40x20|737E 003A 80/6C 60x0A|279F 003E 40/80 40x40|2390 0046 00/18 40x40|2395 004C 40/40 40x40|2394 0052 A0/20 40x40|7401 0059 80/62 60x0A|2389 005F 40/C0 40x40|7487 0066 80/E0 46x20|7075 006E C6/E0 20x20|7629 0073 E6/E0 18x18|273E 007C 00/D8 40x20|75A6 0085 60/00 40x40|2385 008E 80/80 40x40|7448 0095 F7/00 08x60|2592 009B 80/C0 40x20|73BD 009F C0/C0 40x20|75A9 00A4 C0/80 10x40|7927 00AD E8/80 14x14|792A 00B5 E8/94 18x18|23AA 00BD D0/80 18x3E|79B0 00C6 E0/34 14x14
[01] 0000001E|25D7 00C9 E0/40 20x40|26B9 00CF 40/C0 40x40|011A 00D8 00/C0 40x40|2472 00DC 80/40 60x40|2460 00E4 40/00 80x10|279E 00ED C0/00 40x40|2590 00F6 80/10 40x20|27A0 00FA C0/80 40x20|72EF 0103 80/A0 45x60|23B5 010A C5/A0 3Bx60|7545 0111 80/30 40x0A|2830 0117 00/80 80x40|0106 0120 00/00 40x40|78CB 0129 60/40 10x20|78CD 0130 70/40 10x20|78D7 0135 80/80 14x14|78D8 013D 94/80 14x14|7921 0145 40/40 20x40|72F0 014C 60/60 0Dx20|7923 0155 6D/60 10x20|7926 015E 80/94 28x08|23DB 0166 A8/80 08x20|6996 016E B0/80 0Ex20|78C6 0172 00/40 40x40|7B51 0178 40/10 14x14|7B52 0180 54/10 14x14|7B53 0188 68/10 14x14|7B54 0190 40/24 14x14|7B55 0199 54/24 14x14|7B56 01A1 68/24 14x14
[02] 0000001D|6C7B 01A6 00/00 80x40|6CF6 01AA 80/00 60x40|2683 01B3 00/40 40x43|69F1 01B9 40/40 40x40|267E 01BF 80/40 40x40|6D3B 01C5 C0/40 40x40|6D6D 01C9 40/80 40x40|6DEA 01CD 80/80 38x3A|6B4E 01D5 B8/80 30x40|2688 01DD 00/83 38x35|6C3B 01E3 00/B8 30x30|6C3A 01EB 80/BA 30x30|6A53 01F3 E8/80 18x60|2687 01FB B0/C0 28x28|6EF1 0202 E0/00 20x20|27A1 020A 70/C0 10x40|75DF 0211 D8/C0 10x40|7500 0218 E8/E0 18x18|7501 0221 00/E8 18x18|7502 022A 18/E8 18x18|762C 0233 E0/20 18x18|78DA 023A 80/EA 14x14|79B3 0242 B0/E8 18x18|267C 024B 30/C0 40x13|7B4B 0253 94/EA 16x10|7B4E 025C 58/D3 16x10|7B4F 0265 58/E3 14x0D|7B50 026D 30/D3 24x13|7C12 0274 48/F0 14x0A
[03] 0000000C|23B9 0279 00/00 40x40|23C1 0280 00/80 80x40|23C3 0289 00/C0 80x40|23C2 028F 80/80 80x40|23C6 0295 80/C0 80x40|7007 029E C0/40 40x40|2645 02A7 C0/00 40x40|23BF 02B0 80/40 40x40|23BD 02B9 00/40 40x40|23BE 02C2 40/40 40x40|23BB 02CB 80/00 40x40|264B 02D4 40/00 40x40
[04] 0000000D|23C9 02DD 80/40 80x40|23D5 02E6 40/80 40x40|2402 02EF 40/E0 40x20|23C7 02F6 40/00 80x40|23C5 02FC 00/00 40x40|23D6 0305 80/80 40x40|23D8 030E 00/C0 40x40|23D7 0317 C0/80 40x40|23E5 0320 C0/C0 40x40|23D3 0326 C0/00 40x40|270F 032F 00/40 80x40|2644 0335 00/80 40x40|768B 033E 80/C0 40x30
[05] 0000000C|23E6 0343 00/00 40x40|23EA 034A 00/40 80x40|23EC 0353 00/80 80x40|23ED 035C 80/80 80x40|23F0 0365 80/C0 40x40|23E9 036E C0/00 40x40|23E7 0375 40/00 40x40|23EB 037E 80/40 80x40|264A 0387 80/00 40x40|23EF 038E 40/C0 40x40|23F1 0397 C0/C0 40x40|23EE 03A0 00/C0 40x40
[06] 0000000C|23F4 03A9 00/40 80x40|23F5 03AF C0/00 40x40|23F6 03B8 80/40 80x40|23FB 03C1 C0/80 40x40|23F8 03C9 40/80 40x40|23FC 03D2 80/C0 40x40|23F9 03DA 80/80 40x40|23FD 03E2 C0/C0 40x40|2400 03EA 00/80 40x40|23FA 03F0 00/C0 80x40|23F2 03F8 00/00 80x40|23F3 0401 80/00 40x40
[07] 0000000E|2774 040A C0/00 40x40|2401 0411 00/40 40x40|2640 041A 80/80 80x40|2641 0423 00/C0 80x40|28A2 042C 80/C0 17x40|28A3 0435 97/C0 17x40|68A5 043E AE/C0 40x40|6E23 0447 EE/C0 12x40|6E8B 0450 80/00 40x40|6F25 0455 80/40 40x40|2404 045E C0/40 40x40|23FE 0466 00/00 80x40|2405 046E 00/80 80x40|2403 0476 40/40 40x40
[08] 00000008|2409 047D 80/40 80x40|240A 0486 00/80 80x40|240D 048F 80/C0 80x40|2407 0498 80/00 80x40|2406 04A1 00/00 80x40|2408 04AA 00/40 80x40|240C 04B3 00/C0 80x40|240B 04BC 80/80 80x40
[09] 00000008|2411 04C5 80/40 80x40|240F 04CE 80/00 80x40|240E 04D7 00/00 80x40|2410 04E0 00/40 80x40|2413 04E9 80/80 80x40|2414 04F2 00/C0 80x40|2412 04FB 00/80 80x40|2415 0504 80/C0 80x40
[10] 0000000B|2418 050D 00/40 80x40|241C 0516 C0/80 40x40|241F 051F 80/C0 40x40|2416 0528 00/00 80x40|2420 0531 C0/C0 40x40|241A 0538 00/80 80x40|241D 0541 00/C0 40x40|241E 054A 40/C0 40x40|241B 0553 80/80 40x40|2419 055C 80/40 80x40|2417 0565 80/00 80x40
[11] 0000000C|2422 056E 40/00 40x40|2429 0577 80/80 80x40|242A 057F 00/C0 40x40|2771 0587 40/C0 80x40|2772 0590 C0/C0 40x40|2423 0599 80/00 40x40|2425 05A2 00/40 40x40|2426 05A9 40/40 40x40|2421 05B0 00/00 40x40|2424 05B9 C0/00 40x40|2427 05C2 80/40 80x40|27D3 05CA 00/80 80x40
[12] 00000014|2773 05D3 00/00 40x40|2775 05DC 80/00 40x40|2776 05E5 C0/00 40x40|2777 05EE 40/00 40x40|27FC 05F7 40/40 40x40|6A22 0600 00/80 40x40|6A23 0609 40/80 28x40|6A24 0611 68/80 18x40|6CAD 061A 80/80 40x40|6F64 0621 C0/80 20x20|27FB 062A 00/40 40x40|771D 0633 E0/80 20x20|771E 063B 40/C0 40x20|7B9B 0642 00/C0 40x40|768C 064B C0/A0 40x20|7BD5 0650 80/C0 40x40|7BD7 0659 C0/C0 40x40|27FD 0662 80/40 80x40|7CF7 066B 40/E0 20x0C|7CF8 0673 60/E0 20x20
[13] 00000008|242F 067A 00/00 80x40|2430 0682 80/00 80x40|2431 068A 00/40 80x40|2432 0692 80/40 80x40|2433 069A 00/80 80x40|2434 06A2 80/80 80x40|2435 06AA 00/C0 80x40|2436 06B2 80/C0 80x40
[14] 00000009|2437 06BA 00/00 80x40|2438 06C2 80/00 80x40|2439 06CA 00/40 80x40|243A 06D2 80/40 80x40|243B 06DA 00/80 80x40|243C 06E2 80/80 80x40|243D 06EA 00/C0 80x40|243E 06F2 80/C0 40x40|243F 06FA C0/C0 40x40
[15] 00000012|2440 0702 00/00 40x40|2442 070A 80/00 40x40|2443 0712 C0/00 40x40|2444 071A 00/40 40x40|2445 0722 40/40 40x40|2446 072A 80/40 40x40|2447 0732 C0/40 40x40|2448 073A 00/80 40x40|2449 0742 40/80 40x40|244A 074A 80/80 40x40|244B 0752 C0/80 40x40|244C 075A 00/C0 40x40|244D 0762 40/C0 40x40|244E 076A 80/C0 80x10|244F 0771 80/D0 7Bx10|2450 0778 80/E0 40x10|2451 077C C0/E0 40x10|2441 0784 40/00 40x40
[16] 00000010|6AD1 078C C0/C0 30x40|2459 0795 00/00 40x40|245A 079E 40/00 40x40|687D 07A7 40/C0 40x40|687F 07B0 A8/C0 18x40|6882 07B9 F0/C0 10x40|687C 07C2 00/C0 40x40|687E 07CB 80/C0 28x40|6940 07D4 00/40 40x40|6874 07DD C0/00 40x40|6876 07E6 80/40 40x40|245E 07EF B0/00 10x40|6879 07F8 40/80 80x40|6878 0801 00/80 40x40|6877 080A C0/40 40x40|7A57 0813 40/40 40x40
[17] 0000000A|2454 081A 00/40 80x40|2455 0823 80/40 80x40|2456 082A 00/80 80x40|2457 0831 80/80 40x40|2458 083A C0/80 40x40|6880 0843 40/C0 40x40|2452 084C 00/00 80x40|687A 0855 80/00 80x40|245B 085E 00/C0 40x40|7CF5 0867 80/C0 80x40
[18] 00000008|2498 086C 80/C0 80x40|2483 0875 00/00 80x40|2484 087D 80/00 80x40|2486 0885 00/40 80x40|2487 088D 80/40 80x40|2489 0895 00/80 80x40|2488 089D 80/80 80x40|2485 08A5 00/C0 80x40
[19] 0000000F|2493 08AD 40/80 40x40|6DC8 08B5 80/C0 80x28|248B 08BE 40/00 40x40|248C 08C6 80/00 40x40|248D 08CF C0/00 40x40|2496 08D8 00/C0 40x40|248E 08E1 00/40 40x40|248F 08EA 40/40 40x40|2490 08F2 80/40 40x40|248A 08FA 00/00 40x40|2492 0902 00/80 40x40|2494 090A 80/80 40x40|2497 0912 40/C0 40x40|2491 0919 C0/40 40x40|2495 0921 C0/80 40x40
[20] 0000000A|2511 0929 00/80 80x40|2512 0932 00/C0 80x40|250C 093B 20/00 80x40|6CD6 0943 E0/00 20x40|6AB6 094C 80/C0 80x40|250D 0955 00/40 80x40|250E 095E A0/00 40x40|2510 0967 C0/40 40x80|250F 0970 80/40 40x80|249A 0979 00/00 20x40
[21] 00000008|6AB8 0981 00/00 80x40|6AB9 098A 80/00 80x40|6ABC 0993 00/40 80x60|72C5 099C 40/C0 55x40|6ABF 09A1 00/A0 80x20|6AD0 09AA 80/40 80x40|6ACF 09B3 80/80 80x40|6AC0 09BC 00/C0 40x40
[22] 00000006|6AC2 09C5 40/00 80x40|6ACD 09CE C0/00 40x40|6AC7 09D7 00/40 80x40|6AC4 09E0 80/40 80x40|6ACE 09E9 00/80 80x40|6AC1 09F2 00/00 40x40
[23] 00000009|249B 09FB 00/00 80x40|249D 0A02 C0/00 40x40|249E 0A08 00/40 80x40|249F 0A0E 80/40 80x40|24A0 0A15 00/80 80x40|24A1 0A1C 80/80 80x40|24A2 0A22 00/C0 80x40|24A3 0A28 80/C0 80x40|71C2 0A2E 80/00 40x40
[24] 0000000C|24A4 0A36 00/00 80x40|24A5 0A3C 80/00 80x40|24A6 0A42 00/40 40x40|24A7 0A49 40/40 40x40|24A8 0A4F 80/40 40x40|24A9 0A55 C0/40 40x40|24AA 0A5C 00/80 40x40|24AB 0A63 40/80 40x40|24AD 0A6A C0/80 40x40|6E86 0A71 00/C0 80x40|71C0 0A76 80/C0 80x40|71C1 0A7C 80/80 40x40
[25] 0000000B|6ED2 0A82 40/00 40x40|6ED3 0A8B 80/00 80x40|6ED4 0A94 00/40 40x40|6FA1 0A9D 40/40 40x40|6FA2 0AA6 80/40 40x40|6FBF 0AAF 00/80 80x40|716C 0AB8 00/00 40x40|716D 0AC1 80/80 80x40|716E 0ACA 00/C0 80x40|71C3 0AD3 C0/40 40x40|71FE 0AD9 80/C0 80x40
[26] 0000000F|71FF 0ADF 00/00 40x40|7200 0AE5 40/00 40x40|7546 0AED 80/00 80x40|7690 0AF6 00/40 60x30|7691 0AFB 60/40 20x20|7692 0B01 80/40 40x40|76F3 0B09 C0/40 40x40|76F4 0B10 60/80 40x40|76CA 0B17 00/70 60x18|7758 0B1C A0/80 1Ax40|77A7 0B23 BA/80 40x40|77A8 0B2B 00/C0 80x40|781A 0B32 00/88 60x30|7C6D 0B39 80/C0 40x40|7C6E 0B42 C0/C0 40x40
[27] 0000000A|7C63 0B4B 00/00 80x40|7C64 0B54 80/00 80x40|7C65 0B5D 00/40 80x40|7C66 0B66 80/40 80x40|7C67 0B6F 00/80 80x40|7C68 0B78 80/80 80x40|7C69 0B81 00/C0 40x40|7C6A 0B8A 40/C0 40x40|7C6B 0B93 80/C0 40x40|7C6C 0B9C C0/C0 40x40
[28] 00000008|24B1 0BA5 00/40 80x40|24B2 0BAE 80/40 80x40|24B3 0BB7 00/80 80x40|24B4 0BC0 80/80 80x40|24B5 0BC9 00/C0 80x40|24B6 0BD2 80/C0 80x40|6BFC 0BDB 80/00 80x40|24AF 0BE4 00/00 80x40
[29] 00000008|24B9 0BED 00/40 80x40|24BA 0BF6 80/40 80x40|24BC 0BFF 00/80 80x40|24BD 0C08 80/80 80x40|24BE 0C11 00/C0 80x40|24BF 0C1A 80/C0 80x40|24BB 0C23 80/00 80x40|7269 0C2C 00/00 80x40
[30] 0000000F|24C1 0C35 40/00 40x40|24C2 0C3E 80/00 40x40|24C3 0C47 C0/00 40x40|24C5 0C50 40/40 40x40|24C7 0C59 C0/40 40x40|24C8 0C61 00/80 40x40|24C9 0C69 40/80 40x40|24CA 0C71 80/80 40x40|24CC 0C79 00/C0 40x40|24CD 0C81 40/C0 40x40|24CE 0C89 80/C0 80x40|24C4 0C92 00/40 40x40|24C6 0C9B 80/40 40x40|24CB 0CA3 C0/80 40x40|6EBB 0CAB 00/00 40x40
[31] 0000000C|24CF 0CB3 00/00 80x40|24D0 0CBC 80/00 80x40|24D1 0CC5 00/40 80x40|6B83 0CCE 00/80 80x40|6B84 0CD7 80/80 40x40|6B88 0CE0 C0/80 10x40|6B89 0CE9 D0/80 18x40|6B8A 0CF2 E8/80 18x40|6B8B 0CFB 00/C0 40x20|6B8C 0D00 40/C0 30x20|24D2 0D06 80/40 80x40|7783 0D0F 70/C0 56x40
[32] 00000005|728D 0D17 00/00 40x40|726D 0D20 40/00 40x40|726E 0D29 80/00 40x40|7270 0D32 00/40 80x40|768D 0D3B 80/40 60x40
[33] 0000000A|6B2D 0D40 80/40 80x40|6B30 0D47 00/C0 40x40|6B32 0D50 80/C0 40x40|6B2B 0D57 80/00 80x40|6B31 0D5E 40/C0 40x40|6B2A 0D65 00/00 80x40|6B2C 0D6C 00/40 80x40|6B2E 0D73 00/80 80x40|6B2F 0D7A 80/80 80x40|6B33 0D81 C0/C0 40x40
[34] 0000000D|6B36 0D88 80/00 40x40|6B37 0D8F C0/00 40x2E|6BEA 0D97 80/C0 80x40|6DB5 0DA0 00/C0 80x40|6B49 0DA9 00/40 40x40|70DD 0DB0 C0/6E 40x12|6B35 0DB9 40/00 40x40|6B4B 0DC0 80/40 40x40|6B38 0DC7 C0/2E 40x40|6B4C 0DCE 00/80 80x40|6B4D 0DD5 80/80 80x40|6B34 0DDC 00/00 40x40|6B4A 0DE3 40/40 40x40
[35] 0000000B|6BE7 0DEA 00/00 40x80|6BE8 0DF3 40/00 80x40|6BE9 0DFC C0/00 40x40|70CF 0E05 00/80 80x40|70D0 0E0C C0/40 40x40|70D1 0E13 80/80 40x40|70D2 0E1A 00/C0 40x40|70D3 0E21 C0/80 40x80|6DA5 0E28 40/C0 80x40|6CAF 0E2F 80/40 40x40|6CAE 0E37 40/40 40x40
[36] 0000000C|70D5 0E3F 40/00 40x40|70D6 0E46 80/40 80x40|70D7 0E4F 40/40 40x40|70D8 0E58 00/80 40x80|70D9 0E61 80/00 80x40|70DA 0E6A C0/80 40x80|70DB 0E73 40/C0 40x2E|70DC 0E7C 40/EE 40x12|6DB6 0E85 40/80 80x40|6DAF 0E8E 80/C0 40x27|6DB0 0E97 80/E7 40x19|70D4 0EA0 00/00 40x80
[37] 0000000A|6DB1 0EA7 00/00 80x40|72AB 0EB0 80/00 80x27|732D 0EB5 80/27 80x40|732F 0EBC 00/40 80x40|7347 0EC2 80/67 40x40|75AC 0EC9 00/80 80x40|75AD 0ED2 C0/67 40x40|75AE 0EDB 80/A7 40x40|75AF 0EE4 C0/A7 40x40|768A 0EED 00/C0 60x30
[38] 00000008|24D5 0EF2 00/00 80x40|24D7 0EFB 00/40 80x40|24DA 0F04 80/80 80x40|24DB 0F0D 00/C0 80x40|24D9 0F16 00/80 80x40|24D6 0F1F 80/00 80x40|24D8 0F28 80/40 80x40|24DC 0F31 80/C0 80x40
[39] 0000000C|2862 0F3A 40/C0 40x40|6BEB 0F43 80/00 40x40|24E5 0F4C 00/C0 40x40|24E4 0F55 C0/80 40x40|24E8 0F5E C0/C0 40x40|24E7 0F67 80/C0 40x40|24DD 0F70 00/00 80x40|24DF 0F79 00/40 80x40|24E0 0F82 80/40 80x40|24E1 0F8B 00/80 80x40|24E3 0F94 80/80 40x40|6BEC 0F9D C0/00 40x40
[40] 0000001A|24F1 0FA6 00/80 40x40|24F3 0FAF 80/80 40x20|24F6 0FB8 C0/A0 40x10|24F7 0FC1 C0/B0 40x10|24F8 0FCA 00/C0 10x40|24F9 0FD3 10/C0 40x20|24FA 0FDC 50/C0 40x20|24EE 0FE5 40/40 40x40|24EC 0FEE C0/00 40x40|2825 0FF7 80/00 40x40|2501 1000 90/E0 20x20|2502 1009 B0/E0 20x20|2503 1012 D0/E0 20x20|2500 101B D0/C0 20x20|24FE 1024 10/E0 80x0C|24FF 102D 10/EC 80x08|24E9 1036 00/00 40x40|24EF 103F 80/40 40x40|24ED 1048 00/40 40x40|24F0 1051 C0/40 40x40|24FB 105A 90/C0 40x20|24F2 1063 40/80 40x40|2509 106C F0/C0 10x40|24F4 1075 C0/80 40x20|24F5 107E 80/A0 40x20|24EA 1087 40/00 40x40
[41] 0000000A|2504 108F 00/00 40x40|6BD4 1098 00/80 80x40|6BD6 10A1 00/C0 80x40|6BD7 10AA 80/C0 80x40|6BD3 10B3 80/40 80x40|6BD5 10BC 80/80 80x40|2506 10C5 80/00 80x40|2507 10CE 00/40 40x40|2505 10D7 40/00 40x40|2508 10E0 40/40 40x40
[42] 0000000B|6C30 10E9 C0/00 40x40|6C7C 10F2 40/40 80x40|6C1B 10F8 00/00 40x40|74D6 1101 80/80 80x40|74D7 110A 00/80 80x40|6C1C 1113 40/00 40x40|6C26 111C 80/00 40x40|74E1 1125 C0/40 40x40|6C70 112E 00/40 40x40|768E 1134 00/C0 40x36|7A56 113A 40/C0 80x40
[43] 0000000C|70AF 1143 00/00 00x40|70B0 114C 00/40 80x40|70B1 1155 80/40 80x40|70B2 115E 00/80 40x80|70B3 1167 C0/80 40x40|70B4 1170 40/C0 20x40|70B5 1179 40/80 40x40|70B6 1182 80/80 40x40|70B8 118B E0/C0 20x40|70BB 1194 A0/C0 40x40|70BC 119D 60/F0 40x10|70C1 11A6 60/C0 40x30
[44] 0000000F|70B7 11AF 20/00 08x40|70B9 11B8 00/00 20x40|70BA 11C1 C0/C0 40x18|70BE 11CA 00/40 80x40|70BF 11D3 00/80 80x40|70C0 11DC 80/40 80x40|70C2 11E5 28/28 80x18|70C3 11EE E8/00 18x40|70C4 11F7 80/80 80x40|70C5 1200 A8/00 40x40|70C6 1209 00/C0 80x40|70C7 1212 C0/D8 40x14|70C8 121B C0/EC 40x14|70C9 1224 80/C0 40x40|70CA 122D 28/00 40x28
[45] 00000007|70BD 1236 00/00 00x40|70CD 123F 40/40 80x40|70CE 1248 C0/40 40x40|7620 1251 00/80 80x40|7C9A 125A 80/80 80x40|70CC 1263 00/40 40x40|7621 126C 00/C0 80x06
*unused*
*unused*
[48] 0000000B|6C73 1275 00/40 80x40|6C78 127B 80/80 80x40|6C79 127F 00/C0 80x40|6C7A 1283 80/C0 80x40|6C76 1287 00/80 40x40|6C75 128B C0/40 40x40|6E1E 128F 40/80 40x40|2648 1293 00/00 80x40|24AC 129A 80/00 40x40|6C72 12A1 C0/00 40x40|6C74 12A5 80/40 40x40
*unused*
[50] 0000001E|6AF4 12A9 00/00 40x20|6AF5 12B1 40/00 40x20|6AF6 12B9 80/00 40x20|6AF7 12C1 00/20 40x20|6AF8 12C9 40/20 40x20|6AF9 12D1 80/20 40x20|6AFB 12D9 40/40 40x20|6AFC 12E1 80/40 40x20|6AFE 12E9 40/60 40x20|6AFF 12F1 80/60 40x20|6B06 12F9 40/A0 40x40|6B08 12FF 00/C0 40x20|6B09 1306 80/C0 40x20|6B0A 130D 00/E0 40x20|6B0B 1313 40/E0 40x20|6B0C 1319 80/E0 40x20|6B00 1320 00/80 40x20|6B01 1328 40/80 40x20|6B02 132F 80/80 40x20|6B03 1337 C0/80 40x20|6B04 133E 00/A0 40x20|6B05 1346 80/A0 40x20|71B2 134E C0/E0 14x14|71B3 1354 D4/E0 14x14|6AFA 135C 00/40 40x20|6AFD 1364 00/60 40x20|6B07 136C C0/A0 40x40|7B2E 1372 E8/E0 10x20|25BF 137B C0/00 40x40|25C6 1384 C0/40 40x40
[51] 0000000F|6BA2 138C 00/00 80x80|6D39 1395 00/C0 80x40|6D3A 139E 80/C0 80x40|6D32 13A7 C0/00 40x40|6D34 13AB 80/40 40x40|6D31 13AF 80/00 40x40|6D37 13B3 80/80 80x40|6D35 13B7 C0/40 40x40|72ED 13BB 00/80 40x40|7624 13C2 40/80 24x20|7C5A 13C9 64/80 18x18|7C5B 13CF 64/98 14x14|7C62 13D6 40/A0 18x18|7D32 13DE 58/AC 14x14|7D33 13E5 6C/AC 14x14
[52] 00000010|6E53 13EB 00/40 80x40|6E88 13EF 00/80 40x40|6E89 13F4 40/80 40x40|6E8A 13F9 C0/80 40x40|6E87 13FE 80/A0 40x40|74FE 1402 80/80 40x20|7A05 140B 00/00 60x3B|74FB 1411 60/00 40x40|6D6E 1419 80/40 80x40|6F55 141D A0/00 20x40|6DEB 1425 C0/00 40x40|6D36 142E 00/C0 80x40|7623 1432 80/E0 80x20|7C60 1439 D4/C0 14x14|7C61 1442 E8/C0 14x14|7D34 1447 C0/C0 0Ex20
[53] 0000000A|6EF0 1450 00/00 60x80|6EF2 1458 60/00 80x40|6F8F 1460 E0/00 20x40|6F90 1469 60/40 40x40|6F91 1472 A0/40 0Cx40|7250 147B 00/80 80x40|7251 1482 AC/40 40x40|7252 1488 80/80 80x40|7253 148E 00/C0 50x16|768F 1496 50/C0 40x30
[54] 00000010|7D41 149B 40/00 40x40|7D42 14A4 80/00 40x40|7D43 14AD C0/00 40x40|7D44 14B6 00/40 40x40|7D46 14BF 80/40 40x40|7D47 14C8 C0/40 40x40|7D49 14D1 00/80 40x30|7D4A 14DA 40/80 40x30|7D4B 14E3 80/80 80x30|7D4C 14EC 00/B0 C0x30|7D4D 14F5 C0/B0 40x10|7D4E 14FE C0/C0 40x40|7D50 1507 80/E0 40x20|7D40 1510 00/00 40x40|7D4F 1519 00/E0 80x20|7D45 1522 40/40 40x40
[55] 00000005|7D35 152B 00/80 00x80|7D51 1533 00/00 80x40|7D52 153C 80/00 80x40|7D53 1545 00/40 80x40|7D54 154E 80/40 80x40
[56] 0000000E|796D 1557 00/00 60x30|796E 155F 60/00 20x30|7972 1566 00/A0 80x30|7975 156D 00/D0 40x30|798D 1574 00/30 80x40|7992 157B 40/D0 40x30|799D 1582 80/00 60x30|799E 158B E0/00 20x30|799F 1594 80/30 80x40|798F 159C 00/70 80x30|79A1 15A4 80/70 80x30|79A2 15AD 80/A0 80x30|7977 15B5 80/D0 40x30|79A4 15BB C0/D0 40x30
[57] 00000007|7978 15C3 00/00 80x40|7979 15CA 80/00 80x40|797A 15D1 00/40 40x30|797B 15D8 40/40 40x30|797C 15DF 80/40 40x30|797D 15E5 C0/40 40x30|7B21 15EC 00/80 00x80
[58] 0000001E|718F 15F4 00/00 40x20|7190 15FC 40/00 40x20|7191 1604 80/00 40x20|7193 160C 00/20 40x20|7194 1614 40/20 40x20|7195 161C 80/20 40x20|7196 1624 00/40 40x20|7197 162C 40/40 40x20|7198 1634 80/40 40x20|719A 163C 00/60 40x20|719B 1644 40/60 40x20|719C 164C 80/60 40x20|719D 1654 00/80 40x20|719E 165C 40/80 40x20|719F 1663 80/80 40x20|71A0 166B C0/80 40x20|71A1 1672 00/A0 40x20|71A2 167A 40/A0 40x40|71A3 1680 80/A0 40x20|71A4 1688 C0/A0 40x40|71A5 168E 00/C0 40x20|71A6 1695 80/C0 40x20|71A7 169C C0/00 40x20|71A8 16A3 C0/20 40x20|23D9 16A9 00/E0 80x20|71FB 16B2 C0/E0 40x0C|71BD 16BB 80/E8 10x10|7625 16C1 90/E8 18x18|2A17 16C9 C0/40 40x40|7D63 16D2 A8/EC 40x13
[59] 0000000C|7259 16DA 00/00 40x40|725A 16E1 40/00 40x40|725B 16E8 80/00 40x40|725C 16EF C0/00 40x40|725E 16F6 00/40 80x40|7260 16FD 80/40 40x40|7261 1704 C0/40 40x40|7262 170B 00/80 80x40|7263 1712 80/80 40x40|7264 1719 C0/80 40x40|7265 1721 00/C0 80x40|7266 1728 80/C0 80x40
[60] 00000002|7267 172F 00/00 50x30|7268 1737 50/00 60x40
[61] 00000012|7CB4 173F 00/00 40x20|7CB5 1748 40/00 40x20|7CB6 1751 80/00 40x20|7CB8 175A C0/00 40x20|7CB9 1763 00/20 40x20|7CBA 176C 40/20 40x20|7CBC 1775 C0/20 40x20|7CBE 177E 00/40 40x40|7CBF 1787 40/40 40x40|7CC0 1790 80/40 40x40|7CC1 1799 C0/40 40x40|7CC2 17A2 00/80 40x40|7CC3 17AB 40/80 40x40|7CC4 17B4 80/80 40x40|7CC5 17BD C0/80 40x40|7CC6 17C6 00/C0 80x40|7CC7 17CF 80/C0 80x40|7CD1 17D8 80/20 40x20
[62] 0000001E|7871 17E1 00/00 40x20|7872 17E9 40/00 40x20|7873 17F1 80/00 40x20|7875 17F9 00/20 40x20|7876 1801 40/20 40x20|7877 1809 80/20 40x20|7878 1811 00/40 40x20|7879 1819 40/40 40x20|787A 1821 80/40 40x20|787C 1829 00/60 40x20|787D 1831 40/60 40x20|787E 1839 80/60 40x20|787F 1841 00/80 40x20|7880 1849 40/80 40x20|7881 1850 80/80 40x20|7882 1858 C0/80 40x20|7883 185F 00/A0 40x20|7884 1867 40/A0 40x40|7885 186D 80/A0 40x20|7886 1875 C0/A0 40x40|7887 187B 00/C0 40x20|7888 1882 80/C0 40x20|7889 1889 C0/00 40x20|788A 1890 C0/20 40x20|788B 1896 C0/40 40x20|788C 189D C0/60 40x20|706F 18A3 00/E0 60x20|7845 18A9 60/E0 30x20|6A84 18B0 90/E0 40x20|79BC 18B4 D0/E0 20x0D
[63] 0000001E|7854 18BC 00/00 40x20|7855 18C4 40/00 40x20|7856 18CC 80/00 40x20|7857 18D4 00/20 40x20|7858 18DC 40/20 40x20|7859 18E4 80/20 40x20|785A 18EC 00/40 40x20|785B 18F4 40/40 40x20|785C 18FC 80/40 40x20|785D 1904 00/60 40x20|785E 190C 40/60 40x20|785F 1914 80/60 40x20|7860 191C 00/80 40x20|7861 1924 40/80 40x20|7862 192B 80/80 40x20|7863 1933 C0/80 40x20|7864 193A 00/A0 40x20|7865 1942 40/A0 40x20|7866 1948 80/A0 40x20|7868 1950 00/C0 40x20|7869 1956 40/C0 40x20|786A 195E 80/C0 40x20|786B 1964 C0/C0 40x20|75A3 196B C0/40 40x40|2A16 1974 C0/00 40x40|7687 197A 80/E0 40x20|786C 1983 00/E0 40x20|7867 1989 C0/A0 40x20|0051 198F C0/E0 40x20|7CEE 1994 40/E0 40x20
[64] 00000005|7CC8 199B 00/00 80x60|7CC9 19A4 80/00 80x60|7CCA 19AD 00/60 80x20|7CCB 19B6 80/60 80x20|7D3F 19BF 00/80 00x80
[65] 0000001D|7586 19C7 00/00 40x20|758A 19CF 00/20 40x20|758D 19D7 00/40 40x20|758E 19DF 40/40 40x20|758F 19E7 80/40 40x20|7591 19EF 00/60 40x20|7592 19F7 40/60 40x20|7593 19FF 80/60 40x20|7594 1A07 00/80 40x20|7595 1A0F 40/80 40x20|7596 1A16 80/80 40x20|7597 1A1E C0/80 40x20|7598 1A25 00/A0 40x20|7599 1A2D 40/A0 40x40|759A 1A33 80/A0 40x20|759B 1A3B C0/A0 40x40|759C 1A41 00/C0 40x20|759D 1A48 80/C0 40x20|7588 1A4F 80/00 40x20|7587 1A57 40/00 40x20|758C 1A5F 80/20 40x20|758B 1A67 40/20 40x20|759E 1A6F 00/E0 40x20|759F 1A75 40/E0 40x20|75A0 1A7C 80/E0 40x20|75DC 1A82 C0/00 40x80|78A8 1A87 C0/E0 14x14|78A9 1A8E D4/E0 14x14|78AA 1A94 E8/E0 14x14
[66] 00000010|7A8B 1A9C 00/00 40x40|7A8E 1AA5 C0/00 40x40|7A8F 1AAE 00/40 40x40|7A92 1AB7 C0/40 40x40|7A93 1AC0 00/80 40x40|7A9A 1AC9 C0/C0 40x40|7A8D 1AD2 40/00 40x40|7A8C 1ADB 80/00 40x40|7A91 1AE4 40/40 40x40|7A90 1AED 80/40 40x40|7A94 1AF6 80/80 40x40|7A99 1AFF 40/C0 40x40|7A95 1B08 40/80 40x40|7A96 1B11 C0/80 40x40|7A9D 1B1A 00/C0 40x40|7A9E 1B23 80/C0 40x40
[67] 00000009|7AA3 1B2C 40/00 40x30|7A97 1B35 00/00 40x30|7A98 1B3E 80/00 40x30|7AA4 1B47 C0/00 40x30|7A9C 1B50 80/30 40x30|7A9B 1B59 C0/30 40x30|7AC2 1B62 00/60 80x20|7AA2 1B6B 00/30 80x30|7D36 1B74 00/80 00x80
[68] 0000000C|7CDB 1B7C 00/00 80x60|7CDC 1B7F 80/00 80x60|7CDD 1B83 00/60 80x40|7CDE 1B85 80/60 80x40|7CDF 1B8B 00/A0 40x30|7CE0 1B8D 40/A0 40x30|7CE1 1B90 80/A0 40x30|7CE2 1B96 C0/A0 40x30|7CE3 1B99 00/D0 40x30|7CE4 1B9D 40/D0 40x30|7CE5 1BA1 80/D0 40x30|7CE7 1BA5 C0/D0 40x30
[69] 00000007|7CE8 1BA9 00/00 40x40|7CE9 1BAD 40/00 60x40|7CEA 1BB1 A0/00 60x40|7CEB 1BB4 00/40 40x30|7CEC 1BB8 40/40 40x30|7CED 1BBA 80/40 80x30|7D3E 1BBE 00/80 00x80
*many unused*
Actual texture data is aligned to 2048 bytes (800h). The textures I have decoded so far are:
Code: Select all
#3 (12 textures) at 0010C000h
#4 (13 textures) at 00114800h
#5 (12 textures) at 0011D000h
#6 (12 textures) at 00125800h
#7 (14 textures) at 0012E000h
These offsets had to be spotted by eyesight, and finding out how Driver 2 gets them would be a leap forward. Other atlas blocks with unknown associations can be found at:
Code: Select all
0002C000
00033800
0003B800
00042800
00049800
00050800
00057000
0005E000
00065000
0006B800
00072000
00079000
00080800
0008C800
00091800
00098000
0009D800
000A4800
000A9800
000B0800
00189800
00192000
These are not as many addresses as there are texture atlases in the 00000022 lump, so I am definitely missing something here.

So, when you find texture blocks, there are two possibilities for how they're stored:

1. As RLE compressed data. This begins with an unknown 4-B number, up to 30 16-color palettes in B5G5R5X1 format, and a bunch of bytes I could not decipher yet. Visible patterns and histogram analysis suggest it is not LZ compression, though.

2. As raw textures (like the five I listed above).
Those begin with a 4-B number which gives the number of palettes used on the atlas. These should be exactly the same as the numbers of textures given for the respective atlas in the 00000022 lump (12 for #3, 13 for #4, 12 for #5, …).
Then, the palettes follow. These are 16 colors each, in B5G5R5X1 format.
Then, at the next 512 B boundary, actual texture data begins. It is 256×256 pixels, with two four-bit indices packed into one byte (uneven X coordinates in the four most significand bits).
Use the texture rectangle given in the 00000022 lump to apply the correct palette to the right pixels – e.g. for texture #3, apply the first palette to the 64×64 rectangle starting at (0, 0); apply the second palette to the 128×64 rectangle starting at (0, 128); and so on.
User avatar
By Fireboyd78
#50671
Your hexadecimal code research is really really confusing. There's no need to write out everything as 8-bytes. That's why we have the magical 0x prefix. Instead of 0000001E, you can just write 0x1E. Much nicer.

As for your texture atlas list, you're using hexadecimal numbers to find a common size. 40x18 is incorrect - that's 0x40 and 0x18. Translation: 64x24!

I'm going to look and see if I can't find you some offsets or something. (Y)
By Krishty
Registration Days Posts Posts Posts
#50673
Well, I wrote the output to help me understand the file's structure, and had in mind it should help you find the according data — and if one looks at a binary file, one pretty much won't see decimal numbers either ;-) Also, I didn't have the time for eye candy; sorry :(
User avatar
By Fireboyd78
#50674
Krishty wrote:Well, I wrote the output to help me understand the file's structure, and had in mind it should help you find the according data — and if one looks at a binary file, one pretty much won't see decimal numbers either ;-) Also, I didn't have the time for eye candy; sorry :(
This is true, but writing 40x18 is still improper. This is helpful, don't get me wrong, I was just trying to give you some advice. The way you did it was a bit too complicated, it could've been much simpler than that. For future reference, I would just write down the offsets of the data, then interpret it:
Code: Select all
Offset: 0x10
Size: 0x8

- First byte is foo, should always be 0xFF
- Next byte is bar, either 0x00 or 0x01
- Next 4 bytes is Foobar, offset to data
- Last 2 bytes is Foobaz, some kind of flag

Pseudo-code:

struct Bazfoo
{
    byte Foo; // always 0xFF
    byte Bar; // 0x0 or 0x1
    uint Foobar; //offset to data
    ushort Foobaz; //some kind of flag
}
That is a completely made up example, but it's just to show you how it could be done. You're trying to take in too much information at once :P
User avatar
By VAIMAHDO
#50748
hahaha that tanner with a hubcap head is epic! Of course I cant understand any of the code... It would be hilarious to make a fat tanner or spam lamp posts all over the place 8)
By Krishty
Registration Days Posts Posts Posts
#50835
Quick note on Driver 1: You know you're on the right track when the game's bugs show up in your own program:

Image

Image
By Krishty
Registration Days Posts Posts Posts
#50846
Olanov wrote:Do you reckon it's the texture for that building causing it?
More specifically, it's the polygon flags. These control how bright polygons are at a certain time of day (e.g. the billboards on broadway are lit at night, but not at day), and in New York, they are plain wrong in a few places. Those are hard to find in the game, but easy to spot from overall view:
Image
Image
I don't know why those flags are used almost never in Miami, Frisco, or NY; but all throughout L.A. — New York could have been made to look as exciting as L.A. easily. I guess they ran out of time.
By Krishty
Registration Days Posts Posts Posts
#50847
Furthermore, there's something like placeholders in L.A.. I discovered them by accident – they are usually not visible because of the rendering order. I guess the game artists used them while designing the levels, and when they were ultimatively replaced by "real" buildings, they were just forgotten. So, many buildings are effectively drawn twice.

Image
User avatar
By Fireboyd78
#50910
This is some really impressive progress. Nicely done!

This is beginning to remind me of Jeff's "level editor" that's probably somewhere on the back burner :P

Image
By Krishty
Registration Days Posts Posts Posts
#50970
Nice; I never saw that one!

My intention is purely extracting the cities, not writing them back. So mine ist just a viewer, not an editor. My compliment to Jeff's work.

Any more information on that topic? The main reason I started analyzing myself is, I never found anything on Driver's level files on the internet. I did search a lot, read tons and tons of topics in archived Driver forums and clicked through hundreds of videos on YouTube. I found Driver Texture Editor, but I never saw something as impressive as the screenshot above …
User avatar
By Fireboyd78
#50972
The reason you never saw that one is because Jeff never released it publicly. As for information on level files for Driver, the Driver Level Editor source code can help to point you in the right direction: https://github.com/someone972/driver-level-editor

It was definitely impressive, just a bit unfortunate that so many rewrites occurred throughout development that it's broken now and as I said, most likely on the backburner. Only Jeff knows. :P
User avatar
By someone972
Registration Days Posts Posts Posts Avatar
#50994
Why does no one tell me when these things happen D: ! You've been doing some fine work! There's a lot of similarities between the D2 format and the D1 PS1 format, so if you're still working on it let me know and I'll try and get you some of the information I've collected. I think the textures are about the same, so let me know if you need the RLE compression scheme. Probably the most reliable way to find me would be on Skype (search for someone972s and look for the green swirl thing), although I poke around here every so often.

Also, you said you looked at the source code for DTE2, and for that I'm so very sorry. So sorry.

And for anyone wondering why the level viewer was never released: It's terrible. Like really terrible. It was built off of DTE 2 which was terrible to begin with, but it morphed into this program where I just slapped anything together to try figure out the level format. Essentially it's plagued by crashes and it can't actually modify levels properly, and the rendering is sooooooo slow. As for the new version of the Driver Level Editor I must confess that I didn't work on it for the longest time, partly because I hadn't fully gotten the level format figured out (which I'm doing now), and partially because I hit a road block in how it should be structured. It's still alive, but still needs a lot of work. Someone just needs to prod me every so often so I get back to work -_-.

Back on topic; It's been a while since I've seen so much good work done with the Driver 2 format. The play station format is definitely a lot more difficult to work with than the PC one. I can't wait to see what you figure out next!
By Krishty
Registration Days Posts Posts Posts
#51010
Nice to finally meet you in person!
someone972 wrote:I think the textures are about the same, so let me know if you need the RLE compression scheme.
Yes, please! :-) Last time I looked at it it was too frustrating and I just pushed it to the end of my to-do.
someone972 wrote:Also, you said you looked at the source code for DTE2, and for that I'm so very sorry. So sorry.
My source code does not look even a little better :wink: I will release the sources one day, but for now, my viewer is not easy to use at all and the level reader is … just as unstable and unfinished as yours. Also, I've got other projects to maintain and I'm only looking at Driver once in a while :(
User avatar
By Fireboyd78
#51013
If you don't mind me asking, what other kinds of projects are you working on? It's interesting to know that you do some Driver stuff in your spare time :P
User avatar
By someone972
Registration Days Posts Posts Posts Avatar
#51016
Basically you read a "control" byte followed by the data for that control. If the control is negative then it is a run of the same byte, of length -control+2. If the control character is >= 0 then it is a couple bytes of data, of length control+1. So here's some examples:

FE 00 corresponds to 00 00 00 00, since FE is negative 2 so count = -(-2)+2 = 4.
01 03 08 corresponds to 03 08
04 0a 0b 0c 0d 0e corresponds to 0a 0b 0c 0d 0e

Here's the code to load the textures, it kind of does decompression in order to figure out how far it needs to read.
Code: Select all
int PSX_CompressedTexture::load(IOHandle handle, IOCallbacks* callbacks)
{
    cleanup();

    unsigned int start = callbacks->tell(handle);

    callbacks->read(&numPalettes,4,1,handle);
    palettes = new PSX_16ColorPalette[numPalettes];
    for(int i = 0; i < numPalettes; i++)
    {
        for(int j = 0; j < 16; j++)
        {
            unsigned short color;
            callbacks->read(&color,2,1,handle);
            palettes[i].setColor(i,color);
        }
    }

    unsigned int imageStart = callbacks->tell(handle);

    int x = 0;
    int y = 0;
    signed char control;
    int count;
    unsigned char datachar;

    unsigned int dataSize = 0;

    while(1)
    {
        callbacks->read(&control,1,1,handle);
        dataSize += 1;
        if(control < 0)
        {
            count = -control+2;
            callbacks->read(&datachar,1,1,handle);
            dataSize += 1;
            for(int i = 0; i < count; i++)
            {
                x+= 2;
                if(x >= 256)
                {
                    y++;
                    x = 0;
                }
            }
            if(y >= 256)
            break;
        }
        else
        {
            count = control+1;
            dataSize += count;
            for(int i = 0; i < count; i++)
            {
                callbacks->read(&datachar,1,1,handle);
                x+= 2;
                if(x >= 256)
                {
                    y++;
                    x = 0;
                }
            }
            if(y >= 256)
            break;
        }
    }

    compressedData = new unsigned char[dataSize];
    callbacks->seek(handle,imageStart,SEEK_SET);
    callbacks->read(compressedData,dataSize,1,handle);
    compressedSize = dataSize;

    return callbacks->tell(handle)-start;
};
Also, this is not all the textures in the level, as I'm sure you've already found out. There are some which are not compressed. If you want I could zip up all the code I have for loading PS1 levels, which although very incomplete, might help with some stuff like models which I believe are the same also.
By Krishty
Registration Days Posts Posts Posts
#51702
Sorry I was inactive for so long, but I finally got around implementing the decompression.
someone972 wrote:Here's the code to load the textures, it kind of does decompression in order to figure out how far it needs to read.
After flipping the texture vertically, it works like a charm — awesome!
Image
someone972 wrote:If you want I could zip up all the code I have for loading PS1 levels, which although very incomplete, might help with some stuff like models which I believe are the same also.
Yes, that would be awesome :-)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 14
Crazy Copper Frenzy

https://youtu.be/xAE3QsULyB4

https://youtu.be/AxdGf3F0yIg

Driv3r "Nice Getaway"

https://youtu.be/CYkmGAPoO9s Lucas in Driv3r's Ni[…]

https://youtu.be/Yvc_xKrKhnc?si=k4I5kraarTXctHJp […]