Welcome, Guest. Please Login or Register
TMA - Temporary Board
 
  HomeHelpSearchLoginRegister  
 
Pages: 1 ... 16 17 18 19 20 ... 58
Send Topic Print
TM 1+2 Modding thread (Read 620469 times)
DefinitelyNotTrollTaco
Certified Astronaut
***
Offline


Glorious Icecream

Posts: 42
Depths of Hell
Gender: male
Re: TM 1+2 Modding thread
Reply #255 - 04/13/17 at 05:41:38
 
Here is the icon. Nothing too amazing but I can make another if necessary. https://www.mediafire.com/?rhga15p9cnzcp8a
Back to top
 
 
IP Logged
 
Marltoro
Senior Member
****
Offline



Posts: 266
Ohio
Re: TM 1+2 Modding thread
Reply #256 - 04/13/17 at 05:56:29
 
DefinitelyNotTrollTaco wrote on 04/13/17 at 05:41:38:
Here is the icon. Nothing too amazing but I can make another if necessary. https://www.mediafire.com/?rhga15p9cnzcp8a


That one will work. Thanks.

And you might want to download the updated version of the toolkit I posted on the previous page.
Back to top
 

Twisted Toolkit
https://drive.google.com/file/d/1Zi-vnTGotGM6lGGX11U7qlWuBk7ZgaeA/view

Source Code Repo
(The source code repo isn't working atm. I need to upload some missing files)
https://bitbucket.org/mrees240/toolkit

Currently working on the Map Editor
 
IP Logged
 
DefinitelyNotTrollTaco
Certified Astronaut
***
Offline


Glorious Icecream

Posts: 42
Depths of Hell
Gender: male
Re: TM 1+2 Modding thread
Reply #257 - 04/13/17 at 06:00:34
 
No problem. Do you think there could be anyway to implement music into the game without a disk in? Maybe a patch? It'd be cool to further modding by adding in an interactive soundtrack.

Yeah I noticed the newly added links. I haven't experienced any glitches, but i didn't want to a take a chance so I installed it.
Back to top
 
 
IP Logged
 
Marltoro
Senior Member
****
Offline



Posts: 266
Ohio
Re: TM 1+2 Modding thread
Reply #258 - 04/13/17 at 20:13:00
 
Now that the core functionality of the texture panel is done, I'm going to work on adding some features to make it more efficient. I plan on adding a Launch TM2 button that will automatically start the patcher and Twisted Metal 2. I'm also going to add a keyboard shortcut for saving as well. At some point I would like to make a Russian version but we'll need someone to help translate it.

I haven't even touched any audio files in TM2 so I wouldn't know how to patch the music.

As for the model viewer portion, I'm not sure how long it will take but I am working on it.

...
Back to top
 

Twisted Toolkit
https://drive.google.com/file/d/1Zi-vnTGotGM6lGGX11U7qlWuBk7ZgaeA/view

Source Code Repo
(The source code repo isn't working atm. I need to upload some missing files)
https://bitbucket.org/mrees240/toolkit

Currently working on the Map Editor
 
IP Logged
 
DefinitelyNotTrollTaco
Certified Astronaut
***
Offline


Glorious Icecream

Posts: 42
Depths of Hell
Gender: male
Re: TM 1+2 Modding thread
Reply #259 - 04/13/17 at 21:12:23
 
The launcher would be a good idea. Definitely save time. Do I need to run the patcher everytime I start it up?
Back to top
 
 
IP Logged
 
Marltoro
Senior Member
****
Offline



Posts: 266
Ohio
Re: TM 1+2 Modding thread
Reply #260 - 04/13/17 at 22:30:15
 
DefinitelyNotTrollTaco wrote on 04/13/17 at 21:12:23:
The launcher would be a good idea. Definitely save time. Do I need to run the patcher everytime I start it up?


I'm going to change the patcher so that once you start it, it won't close when TM2 starts. So you can just start it once and have it run in the background.
Back to top
 

Twisted Toolkit
https://drive.google.com/file/d/1Zi-vnTGotGM6lGGX11U7qlWuBk7ZgaeA/view

Source Code Repo
(The source code repo isn't working atm. I need to upload some missing files)
https://bitbucket.org/mrees240/toolkit

Currently working on the Map Editor
 
IP Logged
 
DefinitelyNotTrollTaco
Certified Astronaut
***
Offline


Glorious Icecream

Posts: 42
Depths of Hell
Gender: male
Re: TM 1+2 Modding thread
Reply #261 - 04/13/17 at 22:49:40
 
Ah okay. I noticed it would shut down and I didn't know if it was done patching or what so. It confused me a bit as to how to use it
Back to top
 
 
IP Logged
 
Big Boss
Hurricane Wrangler
*****
Offline


TM2 PC Online Shill

Posts: 169
Cyburbia
Gender: male
Re: TM 1+2 Modding thread
Reply #262 - 04/14/17 at 01:13:06
 
I suggest if possible make it make backups of the files you edit.
Back to top
 
 
IP Logged
 
Marltoro
Senior Member
****
Offline



Posts: 266
Ohio
Re: TM 1+2 Modding thread
Reply #263 - 04/14/17 at 02:59:39
 
Big Boss wrote on 04/14/17 at 01:13:06:
I suggest if possible make it make backups of the files you edit.


Yeah a backup system shouldn't be too difficult. I'll add it.
Back to top
« Last Edit: 04/14/17 at 06:43:02 by Marltoro »  

Twisted Toolkit
https://drive.google.com/file/d/1Zi-vnTGotGM6lGGX11U7qlWuBk7ZgaeA/view

Source Code Repo
(The source code repo isn't working atm. I need to upload some missing files)
https://bitbucket.org/mrees240/toolkit

Currently working on the Map Editor
 
IP Logged
 
aybe
Certified Astronaut
***
Offline


No matter the consequences

Posts: 39
Re: TM 1+2 Modding thread
Reply #264 - 04/15/17 at 01:25:53
 
@Marltoro

Hi !!!

Thanks for sharing the code, it's been almost a month I've tried to decipher those DPC files and always hit a wall ... Smiley

I guess you've used IDA because the code really looks like what I've seen with it ? Wink

Anyway here's my modest contribution, hopefully things can advance a bit forward: a much simpler DPC parser (hopefully).

Haven't looked in details at your code, tried to step through it a bit but was stumped by the complexity (actually it's just like IDA minus the environment), wondered if there was a much simpler way and it looks like there is (i.e. just tried to understand those pointers and went from there).

So all TM2 files are successfully read, I get I a pretty close model count to yours (there seems to be very small or irrelevant ones my code didn't consider):

Code:
E:\tmp\TM2PC\CARSDB\test\AX.DPC 29 // file + models found in it
E:\tmp\TM2PC\CARSDB\test\BB.DPC 115
E:\tmp\TM2PC\CARSDB\test\FL.DPC 23
E:\tmp\TM2PC\CARSDB\test\HH.DPC 17
E:\tmp\TM2PC\CARSDB\test\HS.DPC 22
E:\tmp\TM2PC\CARSDB\test\IR.DPC 21
E:\tmp\TM2PC\CARSDB\test\MG.DPC 14
E:\tmp\TM2PC\CARSDB\test\MN.DPC 22
E:\tmp\TM2PC\CARSDB\test\OT.DPC 55
E:\tmp\TM2PC\CARSDB\test\PV.DPC 20
E:\tmp\TM2PC\CARSDB\test\RK.DPC 30
E:\tmp\TM2PC\CARSDB\test\SP.DPC 35
E:\tmp\TM2PC\CARSDB\test\ST.DPC 23
E:\tmp\TM2PC\CARSDB\test\TH.DPC 21
 



Here's the source:

Code:
using System;
using System.IO;
using JetBrains.Annotations;

namespace ConsoleApplication1
{
    [PublicAPI]
    public struct Pointer
    {
        public uint Address { get; }

        public Pointer(uint address)
        {
            Address = address;
        }

        public Pointer(BinaryReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException(nameof(reader));

            Address = reader.ReadUInt32();
        }

        public static explicit operator int(Pointer pointer)
        {
            return (int)pointer.Address;
        }


        public static Pointer operator -(Pointer a, Pointer b)
        {
            return new Pointer(a.Address - b.Address);
        }


        public override string ToString()
        {
            return $"0x{Address:X8} ({Address})";
        }
    }

    public static class Extensions
    {
        public static void Offset(this BinaryReader reader, int count)
        {
            reader.BaseStream.Position += count;
        }

        public static void Position(this BinaryReader reader, int position)
        {
            reader.BaseStream.Position = position;
        }

        public static uint PeekUInt32(this BinaryReader reader)
        {
            var u = reader.ReadUInt32();
            reader.Offset(-4);
            return u;
        }

        public static Pointer ReadPointer(this BinaryReader reader)
        {
            return new Pointer(reader);
        }
    }

    internal static class Program
    {
        private static void Main(string[] args)
        {
            //var tpc = @"E:\tmp\TM2PC\CARSDB\WH.TPC";
            //var dpc = @"E:\tmp\TM2PC\CARSDB\WH.DPC";
            //var tpcFile = new TpcFile();
            //var tpcFileController = new TpcFileController(tpcFile);
            //tpcFileController.ReadFile(tpc);
            //var dpcFile = new DpcFile();
            //var dpcFileController = new DpcFileController(dpcFile);
            //dpcFileController.ReadFile(dpc, tpcFile.TimFiles);

            var files = Directory.GetFiles(@"E:\tmp\TM2PC\CARSDB\test", "*.dpc");
            foreach (var file in files)
                GetValue(file);
        }

        private static void GetValue(string path)
        {
            using (var stream = File.OpenRead(path))
            {
                var reader = new BinaryReader(stream);

                // header
                var magic = reader.ReadInt64();
                if (magic != 0x000000434D504344)
                    throw new InvalidDataException();

                var date = new DateTime(1970, 1, 1).AddSeconds(reader.ReadUInt32());

                var ptr1 = reader.ReadPointer();

                // vertices
                reader.Offset(24);
                while (reader.PeekUInt32() != 0x0000FF00)
                    reader.ReadBytes(8);
                reader.ReadUInt32();

                // models
                var modelCount = 0;
                while (stream.Position < stream.Length)
                {
                    while (reader.ReadUInt32() != 0x0000FF00)
                        if (stream.Position == stream.Length)
                            goto end; // no reliable way yet

                    reader.Offset(8);
                    var ptr2 = reader.ReadPointer();
                    var start = ptr2 - ptr1;
                    var count = reader.ReadUInt32();
                    reader.Position((int)start);
                    for (var i = 0; i < count; i++)
                    {
                        var u = reader.PeekUInt32();
                        switch (u)
                        {
                            case 0x05070100:
                                reader.Offset(28);
                                break;
                            case 0x04080100:
                            case 0x05080100:
                                reader.Offset(32);
                                break;
                            case 0x08090100:
                            case 0x06090100:
                            case 0x06090300:
                                reader.Offset(36);
                                break;
                            case 0x060A0300:
                                reader.Offset(40);
                                break;
                            case 0x060B0300:
                            case 0x070B0103:
                                reader.Offset(44);
                                break;
                            case 0x070C0103:
                            case 0x070C0183:
                            case 0x090C0104:
                                reader.Offset(48);
                                break;
                            case 0x070D0183:
                            case 0x090D0103:
                            case 0x090D0104:
                            case 0x090D0184:
                            case 0x090D0303:
                                reader.Offset(52);
                                break;
                            case 0x0C0E0104:
                            case 0x090E0183:
                            case 0x090E0184:
                            case 0x090E0303:
                            case 0x090E0383:
                                reader.Offset(56);
                                break;
                            case 0x0C0F0184:
                            case 0x090F0303:
                            case 0x090F0383:
                                reader.Offset(60);
                                break;
                            case 0x09100383:
                                reader.Offset(64);
                                break;
                            default:
                                throw new NotImplementedException();
                        }
                    }
                    modelCount++;
                }
            end:
                ;
                Console.WriteLine(path + "\t" + modelCount);
            }
        }
    }
}
 



It looks like pretty much other PSX games, ~10 polygon types I guess 4 being triangles, 4 being quads and others for sprites (with flat/gouraud shading flavors or whatever, etc...).

(note: I've reverse-engineered Wipeout 1/2/3 for PSX in the past)

Obviously it's just a parser done in 2 hours and really needs a lot more work, but it achieves reading all TM2 DPCs.

Unfortunately it fails hard on TM1, obviously ... (my favorite game)

Waiting for your comments/remarks, cheers  Smiley
Back to top
 
 
IP Logged
 
Manta Ray
Tom Selleck's Mustache
*****************
Offline



Posts: 538
Re: TM 1+2 Modding thread
Reply #265 - 04/15/17 at 01:50:28
 
This is great. Excited to begin a full HD conversion once I get my Windows laptop back..or maybe I'll just install Bootcamp on my MacBook.
Back to top
 


---===OG "Noob of the Week"===---


...

"WHAAASSSUUUP!"

 
IP Logged
 
aybe
Certified Astronaut
***
Offline


No matter the consequences

Posts: 39
Re: TM 1+2 Modding thread
Reply #266 - 04/15/17 at 02:07:05
 
That was also my intention actually, making some modern engine using Unity or whatever else Smiley

But the road will be long, there are 1000s of things needed yet before dreaming, i.e. getting levels up and understanding everything else necessary !

Tomorrow I'll try to render all these cars then start looking at the levels  Cheesy
Back to top
 
 
IP Logged
 
ヒロ・ハマダ
Superhero Accountant
****
Offline


Hamadian

Posts: 86
Mars
Gender: male
Re: TM 1+2 Modding thread
Reply #267 - 04/15/17 at 03:50:55
 
Anybody got the 'Twisted Metal 2 Pallete .PAL file'? I want to change textures.
Back to top
 

Currently I am trying to understand how to modify Twisted Metal 2 PC.

Twitter account: https://twitter.com/BrandonSelf9
YouTube account: https://www.youtube.com/user/TheApocalypseNine
...
 
IP Logged
 
aybe
Certified Astronaut
***
Offline


No matter the consequences

Posts: 39
Re: TM 1+2 Modding thread
Reply #268 - 04/15/17 at 05:38:33
 
Here is my first take on TM1PC Smiley

An incomplete list of models/polygons in some files, all looked up manually in the file because I couldn't resist not to ...
So far, they seem similar, the only worrying being vertices, they look nothing like it ! Too much granularity in their data, they look rather fixed offsets to something else but it can't be ... @Marltoro if you could shed some light on this that'd be great !

Code:
TM1 polys : header/length
x090c0104	48
x090d0184	52
x05070100	28
x0c0d0104	52
x08080100	32
x070b0103	44
x0c0e0184	56

GENERAL
=======
ptr@24 - ptr@12 == stream size from 0 : LOOKS GOOD SO FAR!
table legend below: model byte offset |	polygon count

compute model polygons offset: modelptr - ptr@12 as 32-bit values!

mmaxend
=======
4256	124
10360	82
14384	19
15372	11
15972	1
16260	1

copend
======
3628	103
8648	45
10844	23

ttlsrn
=======
80		1

optscrn
=======
80		1

kirkscrn
=======
80		1

audscrn
=======
80		1

calysrn
=======
80		1

legal
=====
176		4

devscrn
=======
208		1
364		4

carcards
========
464		1
620		12

inscrn
======
528		1
684		8
1176	4
1476	2

keyscrn
=======
528		1
684		8
1176	4
1476	2

netscrn
=======
912		6
1308	1
1464	8
1956	4
2256	6
2652	2

infostat
========
816		6
1500	12
 



Tomorrow is another day !

Maybe you know it already but excellent HexEditPro is now freeware Smiley Smiley Smiley

http://www.hexedit.com/downloads.aspx

Needless to say but its coloring is simply a killer feature as it allow to spot things out very easily:

...



HiroHamada,

I think you could with tim2view since apparently it can replace TIMs in files (not tested), https://github.com/lab313ru/tim2view/releases

...
Back to top
 
 
IP Logged
 
aybe
Certified Astronaut
***
Offline


No matter the consequences

Posts: 39
Re: TM 1+2 Modding thread
Reply #269 - 04/15/17 at 05:50:52
 
btw forgot to mention,

GHO, author of DXWND managed to get TM1 PC working perfectly on Win10 !

I added a mini-patch for the utterly fast menus time-out (in-game speed was fine anyway)

here's the full thread: https://sourceforge.net/p/dxwnd/discussion/general/thread/6926f8ab/
Back to top
 
 
IP Logged
 
Pages: 1 ... 16 17 18 19 20 ... 58
Send Topic Print