Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 9:22 am
All times are UTC + 0
New about SHP format (TS/RA2/YR)
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [28 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Sun Jul 02, 2006 1:41 pm    Post subject:  New about SHP format (TS/RA2/YR) Reply with quote  Mark this post and the followings unread

Yesterday I have found out an interesting thing
After 6 hours disassembling GAMEMD.EXE Smile

Frame info header new declaration:
typdef struct tagSHPFRAMEINFO
{
WORD wX
WORD wY;
WORD wDX;
WORD wDY;
BYTE byFlags;
BYTE byAlign[3];
COLORREF clrTransparent;
DWORD dwRes;
DWORD dwOffset;
} SHPFRAMEINFO;

byFlags only ONE byte (Not four)
it can be: 0, 1, 2, 3
File with byFlags == 2 for example RADARY.SHP (ra2md.mix->sidec02md.mix)
SHP Builder 3.35 don't show it correct
When byFlags == 2 in each line first two bytes are width of line
Another interesting thing - clrTransparent
maybe it is transparent color
dwRes looks really reserved Smile

Back to top
View user's profile Send private message Skype Account
Crimsonum
Seth


Joined: 14 Jul 2005
Location: Fineland

PostPosted: Sun Jul 02, 2006 1:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

What is this doing in CnC Editing Tools? and I think we don't need information related hacking exe...

_________________


Back to top
View user's profile Send private message
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Sun Jul 02, 2006 2:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yuri 06 wrote:
What is this doing in CnC Editing Tools? and I think we don't need information related hacking exe...

But SHP Builer don't display some files correctly and some files don't display correctly in game

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Sun Jul 02, 2006 3:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

@Yuri06: The guy really has some cool info. And it can be used on any SHP related tool. So, he did post it in the correct place.


@C&CK: Very interesting stuff. I've tested the radar file that you mentioned, and you are right. XCC displays it in a better way than OS SHP Builder does.


Quote:
BYTE byFlags;
BYTE byAlign[3];
COLORREF clrTransparent;
DWORD dwRes;
DWORD dwOffset;


byFlags: That's the compression type of the frame. I was aware of the compression 1 and 3. The 0 works like 1. But I never saw the two before. So, as you are saying, the 2 works similarly to the compression 3. But are you sure that the first two bytes are really the width of the line? I'm asking that, because, with compression 3, the first 2 bytes are the width of the line. So, it's like... the line data starts on byte 3.

byAlign: I'd like to know how this stuff works out. I know that some 'TS' files from RA2.mix uses different values for it. OS SHP Builder even has a special treatment for them, treating them as compression 3.


Code:
         if (SHP.Data[x].header_image.compression = 3) or
            (SHP.Data[x].header_image.compression = -859045885) then



I'll take a new look at these files.


clrTransparent: That's definittelly the transparent colour on RGBA format.


DwRes: Yes, it is reserved. Westwood always has these trashes in their files. W3D is also full of them.




Thanks a lot for the info and I'll look into this align stuff.

Back to top
View user's profile Send private message Visit poster's website Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Sun Jul 02, 2006 4:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

Update: Compression 2 is the compression 3 without the treatment for 0. Here's the source from OS SHP Builder 3.36 Beta 05:


Code:
procedure reinterpretwordfrombytes(Byte1, Byte2: byte; var FullValue: word); overload;
begin
   FullValue := (Byte2 * 256) + Byte1;
end;


// 3.36: Decode Compression 2.
procedure Decode2(const Source: Tdatabuffer; var Dest: Tdatabuffer;
   const cx, cy: integer; var max: integer);
var
   SP, DP, y, maxdp: integer;
   Count : word;
begin
   maxdp := cx * cy;
   SP := 0;
   DP := 0;

   for y := 1 to cy do
   begin
      reinterpretwordfrombytes(Source[SP], Source[SP + 1], Count);
      Count := Count - 2;
      inc(SP,2);
      while Count > 0 do
      begin
         Dec(Count);
         if (SP > max) or (DP > maxdp) then
            exit; // SP has reached max value, exit
         Dest[DP] := Source[SP];
         Inc(SP);
         Inc(DP);
      end;
      if (SP >= max) or (DP >= maxdp) then
         exit; // SP has reached max value, exit
   end;
end;

Back to top
View user's profile Send private message Visit poster's website Skype Account
Tratos
General


Joined: 01 Jan 2003

PostPosted: Sun Jul 02, 2006 7:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yuri 06 wrote:
What is this doing in CnC Editing Tools? and I think we don't need information related hacking exe...


Why not, if this helps make the tools better then it's a good thing.

Back to top
View user's profile Send private message Send e-mail
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Sun Jul 02, 2006 8:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

BYTE byFlags; ONLY ONE byte Smile
Maybe byFlags contains a bit mask, not number Question
0 - 00
1 - 10
2 - 10
3 - 11
In code I found that engine test only bit 2 in byFlags
and don't use byAlign[3]?!?!
I will continue work and I will try to find out the correct order of loading of a SHP file Smile

"some 'TS' files from RA2.mix uses different values for byFlags"
Can you tell me some examples?

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Sun Jul 02, 2006 9:32 pm    Post subject: Reply with quote  Mark this post and the followings unread

Regarding the examples, honestly, at ra2.mix I don't remember anymore... but at language.mix, you'll find a lot of TS cameos inside it. Test them and you'll see that they use the Align stuff.

Back to top
View user's profile Send private message Visit poster's website Skype Account
Crimsonum
Seth


Joined: 14 Jul 2005
Location: Fineland

PostPosted: Mon Jul 03, 2006 7:24 am    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
@Yuri06: The guy really has some cool info. And it can be used on any SHP related tool. So, he did post it in the correct place.


oh, my bad Embarassed

I'm not very used to programming, so...

_________________


Back to top
View user's profile Send private message
ChielScape
General


Joined: 07 Mar 2006
Location: In ur BIOS, Steeln ur Megahurtz!

PostPosted: Mon Jul 03, 2006 8:01 am    Post subject: Reply with quote  Mark this post and the followings unread

then dont say thing about something you dont understand.

_________________
Please, read the signature rules of the forum.

Back to top
View user's profile Send private message Send e-mail Skype Account
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Mon Jul 03, 2006 11:44 am    Post subject: Reply with quote  Mark this post and the followings unread

I have found interesting thing - file limitation
C&C Yuri's Revenge read ONLY (3 * 1024 * 1024) from file (never more 3Mb) Mad
So any SHP file with FileSize > 3Mb not correct
I am not testing it, yet

TS = dirtexpl.shp fsair.shp fsgrnd.shp fsidle.shp inviso.shp lobrdg01.shp null.shp
RA2 = ngmisl.shp ngiron_e.shp nghand_b.shp natbnk.shp inviso.shp ggpile_c.shp ggpile_b.shp gclock2.shp c_shadow.shp null.shp pwrlvl.shp tstlexp.shp yagntcmk.shp
and it not the full list...
It is files list with byFlags not equal 0, 1, 2, 3
Interesting is byFlag == 4 it is "NULL" frame Exclamation Question

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Mon Jul 03, 2006 7:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

dirtexpl.shp has a frame with compression 77 !? But, yea, it's a blank frame.

Back to top
View user's profile Send private message Visit poster's website Skype Account
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Mon Jul 03, 2006 8:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Banshee wrote:
dirtexpl.shp has a frame with compression 77 !? But, yea, it's a blank frame.

Number not is important Smile
Important ONLY SECOND bit Smile
0 - 00000000b
1 - 00000001b
2 - 00000010b
3 - 00000011b
4 - 00000100b
5 - 00000101b
6 - 00000110b
77 - 01001101b
Replace in file 3 -> 6 and it work[/b]

Back to top
View user's profile Send private message Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Tue Jul 04, 2006 6:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Hmm... any chance of finding that mysterious radar colour needed for TS tiberium?

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Tue Jul 04, 2006 10:46 am    Post subject: Reply with quote  Mark this post and the followings unread

Nyerguds wrote:
Hmm... any chance of finding that mysterious radar colour needed for TS tiberium?

There can be it clrTransparent;
This color is used near RadarColor Smile Smile

Back to top
View user's profile Send private message Skype Account
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Wed Jul 05, 2006 2:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Then could you check if there's something special like that in the TS tiberium SHP file? Smile

_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Thu Jul 06, 2006 3:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nyerguds wrote:
Then could you check if there's something special like that in the TS tiberium SHP file? Smile

OK....
I check it later Smile

Back to top
View user's profile Send private message Skype Account
xeniter
Civilian


Joined: 06 Sep 2006

PostPosted: Sun Sep 10, 2006 8:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Code:
Yesterday I have found out an interesting thing
After 6 hours disassembling GAMEMD.EXE


Quote:
typdef struct tagSHPFRAMEINFO
{
WORD wX
WORD wY;
WORD wDX;
WORD wDY;
BYTE byFlags;
BYTE byAlign[3];
COLORREF clrTransparent;
DWORD dwRes;
DWORD dwOffset;
} SHPFRAMEINFO


this looks like c++ source, have you converted the assembler to c or have you used a tool for it

how have you find the right variable names? in asm source there are no var names like in original source

how have you done it?

or is my mind wrong?

Back to top
View user's profile Send private message
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Mon Sep 11, 2006 12:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
how have you find the right variable names? in asm source there are no var names like in original source

I don't know original but can re-do it Smile
Quote:
this looks like c++ source

It's structure declaration Smile

_________________
ARM forever - x86 sucks

Back to top
View user's profile Send private message Skype Account
aliask
Guest




PostPosted: Sun Jun 17, 2007 2:49 am    Post subject: Reply with quote  Mark this post and the followings unread

Can I confirm, is compression type 2 exactly the same as no compression, but with 2 bytes at the start of each line to indicate how many bytes are in the line?

Back to top
gufu
Defense Minister


Joined: 22 Dec 2004
Location: Tiberium Research Center N27

PostPosted: Sun Jun 17, 2007 3:10 am    Post subject: Reply with quote  Mark this post and the followings unread

So I guess those are 2d encoded SHP's?

_________________
DUNK!

Back to top
View user's profile Send private message Skype Account
aliask
Guest




PostPosted: Sun Jun 17, 2007 3:33 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, for RA2/TS/YR.

Back to top
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Sun Jun 17, 2007 12:15 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yea, aliask. It has two bytes for the size and no compression.

Back to top
View user's profile Send private message Visit poster's website Skype Account
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Sun Jun 17, 2007 7:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Exist only TWO types of SHP 2 files:
1)without compression - second bit in flags is clear.
2)with RLE compression - second bit in flags is set.

You still not believe me?

Check it by hands.

Open a glslmd.shp file in HEX editor, find frame flags byte
(there only one frame), (file offset is 10h bytes)
and replace it by 3, AAh, or by any number with second bit = 1.
Run the game!

You still see correct load screen Smile

however glslmd.shp have pixels with color = 0 at all.

_________________
ARM forever - x86 sucks

Back to top
View user's profile Send private message Skype Account
aliask
Guest




PostPosted: Mon Jun 18, 2007 2:13 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm just trying to understand - it's not a matter of not believing you. Please don't be offended.

It seems there are two conflicting view. Banshee says there is a difference, but VK says otherwise. Do files that have 0x02 for the flag have different compression or the same? I've never seen one of these files, and it's a little hard for me to check, I'm trying to write a complete decoder, but I only have one SHP file to work with (which is 0x03)

Back to top
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Mon Jun 18, 2007 3:07 am    Post subject: Reply with quote  Mark this post and the followings unread

Don't be confused on that. CnCVK is right. The second bit 1 determines if it's compressed or not. Compression 0x02 doesn't have compression. 0x03 has compression.

Back to top
View user's profile Send private message Visit poster's website Skype Account
VK
Pyro Sniper


Joined: 28 Jul 2005
Location: in GAMEMD.EXE

PostPosted: Mon Jun 18, 2007 4:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
Compression 0x02 doesn't have compression. 0x03 has compression.

None Smile

0x01 = 01b -> no compression
0x02 = 10b -> RLE compression
0x03 = 11b -> RLE compression

but compression never used because image haven't pixels with zero color at all!

Quote:
It seems there are two conflicting view. Banshee says there is a difference, but VK says otherwise. Do files that have 0x02 for the flag have different compression or the same? I've never seen one of these files, and it's a little hard for me to check, I'm trying to write a complete decoder, but I only have one SHP file to work with (which is 0x03)

use code like this:
Code:

if (info->flags & 0x02)
{
  // the second bit is set - use code for RLE compression
}
else
{
 // the second bit is clear - use code for uncompressed data
}

_________________
ARM forever - x86 sucks

Back to top
View user's profile Send private message Skype Account
aliask
Guest




PostPosted: Tue Jun 19, 2007 12:37 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for clarifying, I'll fix up that page in the wiki then.

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [28 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.2337s ][ Queries: 11 (0.0091s) ][ Debug on ]