Re: Hires GPI and the GPH file
Date: October 12, 2020 03:28PM
Posted by: 32BOBO32
You are doing a really nice and great work which will allow all of us to use hi res GPI for next years =)
Thanks petrus!

Samuele
32BOBO32
Re: Hires GPI and the GPH file
Date: October 12, 2020 10:07PM
Posted by: petrus
GPHUpdater v.0912

The new version of GPHUpdater is ready for download.
It has added the support or stretching/compressing GPI file images by changing the width resp. height dimension values.
Example of GPH.INI specifications (omit \ before Size):
[Vars]
drivers = 33,55,56,60-64,66,68,70,72,74,75,193,268-273,304 
trackmaps = 14-30
...
[\Size] 
%drivers%  = 512x512, 0.75
%trackmaps% =       , 0.75
This will create a GPH file with hires driver images. Driver and trackmap images will have a compressed size: the width is set to 0.75 (=3/4) of the original value which is perfect as compensation for a widescreen stretch. The trackmaps width x height is not specified and will therefore not be changed.
The log file will document the result:
drivers
ID    Offset  width height  asp.ratio  dimh  dimv       width height asp.ratio  v_dim h_dim   vres  hres
0021  000648  0100  0100    256x256    3F80  3F80  ==>  0200  0200   512x512          3FAA    1     0.75
...
trackmaps
ID    Offset  width height  asp.ratio  dimh  dimv       width height asp.ratio  v_dim h_dim   vres  hres
000E  0002DE  0100  0100    256x256    3F80  3F80  ==>                                3FAA    1     0.75
...
The new horizontal dimension floating point value 3FAA was created in these cases. The vres and hres columns show the rounded quotients of v_dim/dimv and h_dim/dimh as a control.

To change the height dimension also, you write the factor as third parameter in the "Size" section, e.g.
33 = , 0.5, 0.5
will compress the driver01 image to the upper left quarter of the original image display area.

I have added some checking routines, so you will be warned more often if your INI file input is not valid.


petrus' gpaedia files



Edited 3 time(s). Last edit at 12/15/2022 08:33PM by petrus.
Re: Hires GPI and the GPH file
Date: October 13, 2020 10:10AM
Posted by: Turbo Lover
Great stuff petrus.



My Grand Prix 4 Files

I'm a total dick. How many people can say that?
Re: Hires GPI and the GPH file
Date: October 16, 2020 02:09PM
Posted by: petrus
Hires GPI Tips

Hires sizes

A hires GPI size twice as large (x2) as the original GP4 size will usually be okay. In special cases x4 (example: logos) or even x8 (example: teamart helmets) can be considered. A hires 4:3 format for a HD (1920x1080) screen would be 1280x960, which is just twice as large as 640x480.
Sometimes the GPI file is not shown in his original size but is stretched. This is for example the case with teamart logos and helmets. Here the size of the part of the screen used by the GPI should give a good estimate.
It is unreasonable to use larger sizes. They will not enhance the display but use unnecessary large disk space.

GP4 does not always use the values from the GPH file. For example the trackmaps corner number GPI files 155-174 have a standard size of 32x32. You may try to change their size in the GPH file, but GP4 always uses 32x32 and ignores the updated sizes.

GPI creating programs

To create GPI files from a TGA images you can use GPIBrowser 1.2 by Lo2k or Slimtex, included in the ZAZ tools. GPI files created with these programs from the same TGA are identical. GPIBrowser does only accept 32bit uncompressed TGA and will display a message if the format is different. Slimtex can work with RLE compressed TGA files also.

GPIBrowser does only work inside a GP4 environment. It uses the GPH file to get resp. set the GPI sizes. Therefore if you copy a GPI file that does not have the size given to its ID in the GPH file into the image folder GPIBrowser is working with, you will get an exception error. To make the program work again, you will have to update the GPH file with the correct values.
If a TGA file is put into the browser, all sizes are taken, the preview image is visible and the GPH file will be updated accordingly.
But the GPI may be displayed incorrectly in GP4 all the same. The GPI (back) to TGA conversion does work properly, so you will get a valid TGA file even if the size is not a standard one.

Slimtex can work with files in any chosen folder. It does not use the GPH file. The Slimtex GPI-Viewer does only accept a widht/height that does already exist in GP4. All other GPI files will have a corrupted display. Though the viewer does not show the GPI correctly, the program may still create a usable GPI file (example: gridcar 400x99). But if the not standard GPI is converted back to TGA a default 512x512 size is taken and the image most probably remains corrupted.

Tests

driver
ID  widthxheight    gpibrowser  slimtex-gpi2tga       GP4_dsp
33  512x512 (x2)    0200 0200   512x512 okay          okay
33  412x412         019c 019c   512x512 corrupt       defect: smaller 412 size?
33  640x640         0280 0280   512x512 corrupt       defect: smaller 1/4?

logo
ID  widthxheight    gpibrowser  slimtex-gpi2tga       GP4_dsp
51  256x192 (x2)    0100 00c0   256x192 okay          okay
51  512x384 (x4)    0200 0180   512x512(out of range) okay

gridcar
ID  widthxheight    gpibrowser  slimtex-gpi2tga       GP4_dsp
178 400x100 (x2)    0190 0064   512x512 corrupt       okay
178 400x99 (x2-1)   0190 0063   512x512 corrupt rev.  okay

weather
ID  widthxheight    gpibrowser  slimtex-gpi2tga       GP4_dsp
124 320x256 (x2)    0140 0100   512x512 corrupt rev.  okay
124 640x512 (x4)    0280 0200   512x512 corrupt       okay


petrus' gpaedia files



Edited 1 time(s). Last edit at 10/13/2021 03:44PM by petrus.
Re: Hires GPI and the GPH file
Date: April 26, 2021 03:22PM
Posted by: petrus
GPI files with subareas and the meaning of the GPH extra bytes

In the GPH file some areas are filled with bytes that do not fit into the GPI file record structure. They occur after the following GPI records as seen in GPHOffsets.txt:
ID ID-hex bytes
  8 0008   32
  9 0009   32
 10 0010   64
 34 0022   32
 42 002A  256
141 008D  480

To get an idea about the meaning of those bytes, I took a closer look at these GPI images. Figures 42 and 141 in particular show what is going on here.


Apparently these special GPI files are subdivided to support alternative selection or animation. After a full analysis of the corresponding GPH files content, I came to the following conclusion:
The extra bytes consist of 16 bytes for each subarea: 4 bytes for every X- resp. Y-value, which gives 8 for any "point" where two "points" define a subarea (top-left to bottom-right). As madman271 pointed out (see chapter GPH record: horizontal and vertical stretch values), are "... these values similar like when we using UV mapping, mean minimum value is 0.0 and maximum value is 1.0."

GPH file analysis of the GPIs with subareas:

GPI 008

Offset:
ID  ID_Hex Offset   Length   width  height  asp.ratio  dimension   vdim hdim   dimh dec   dimv dec 
8   0008   00014A   46       0040   0040    64x64      3F80 3F80   3F80 3F80   1          1    
           000178 32 bytes
Bytes:
014A: 08 00 00 00 02 00 40 00 00 00 40 00 00 00 00 00 
      00 00 00 00 80 3F 00 00 80 3F 01 00 00 00 00 00 
      00 00 00 00 00 00 00 00 80 3F 00 00 80 3F 
0178: 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 80 3F	= 0.0, 0.0 / 0.5, 1.0
      00 00 00 3F 00 00 00 00 00 00 80 3F 00 00 80 3F	= 0.5, 0.0 / 1.0, 1.0		
3F8000 = 1, 3F0000 = 0.5
=> 2 subareas


GPI 009

Offset:
ID  ID_Hex Offset   Length   width  height  asp.ratio  dimension   vdim hdim   dimh dec   dimv dec 
9   0009   000198   78       0010   0008    16x8       3F80 3F00   3F00 3F80   1          0.5
           0001C6 32 bytes
Bytes:
0198: 09 00 00 00 02 00 10 00 00 00 08 00 00 00 00 00   
      00 00 00 00 80 3F 00 00 00 3F 00 00 00 00 00 00 
      00 00 00 00 00 00 00 00 00 3F 00 00 80 3F 
01C6: 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 3F  = 0.0, 0.0 / 0.5, 0.5
      00 00 00 00 00 00 00 3F 00 00 00 3F 00 00 80 3F  = 0.0, 0.5 / 0.5, 1.0
=> 2 subareas

GPI 010

Offset:
ID  ID_Hex Offset   Length   width  height  asp.ratio  dimension   vdim hdim   dimh dec   dimv dec 
10  000A   0001E6   78       0010   0010    16x16      3F80 3F80   3F80 3F80   1          1 
           000214 64 bytes
Bytes:
01E6: 0A 00 00 00 04 00 10 00 00 00 10 00 00 00 00 00 
      00 00 00 00 80 3F 00 00 80 3F 00 00 00 00 00 00 
      00 00 00 00 00 00 00 00 80 3F 00 00 80 3F 
0214; 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 3F	= 0.0, 0.0 / 0.5, 0.5
      00 00 00 00 00 00 00 3F 00 00 00 3F 00 00 80 3F	= 0.0, 0.5 / 0.5, 1.0
      00 00 00 3F 00 00 00 00 00 00 80 3F 00 00 00 3F	= 0.5, 0.0 / 1.0, 0.5
      00 00 00 3F 00 00 00 3F 00 00 80 3F 00 00 80 3F	= 0.5, 0.5 / 1.0, 1.0
=> 4 subareas

GPI 034

Offset:
ID  ID_Hex Offset   Length   width  height  asp.ratio  dimension   vdim hdim   dimh dec   dimv dec 
34  0022   000676   46       0040   0020    64x32      3F80 3F00   3F00 3F80   1          0.5 
           0006A4 32 bytes
Bytes:
0676: 22 00 00 00 02 00 40 00 00 00 20 00 00 00 00 00 
      00 00 00 00 80 3F 00 00 00 3F 00 00 00 00 00 00 
      00 00 00 00 00 00 00 00 00 3F 00 00 80 3F 
06A4: 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 3F	= 0.0, 0.0 / 0.5, 0.5 
      00 00 00 00 00 00 00 3F 00 00 00 3F 00 00 80 3F	= 0.0, 0.5 / 0.5, 1.0
=> 2 subareas

GPI 042

Offset:
ID  ID_Hex Offset   Length   width  height  asp.ratio  dimension   vdim hdim   dimh dec   dimv dec 
42  002A   000806   46       0100   0080    256x128    3F80 3F00   3F00 3F80   1          0.5 
           000834 256 bytes
Bytes:
0806: 2A 00 00 00 10 00 00 01 00 00 80 00 00 00 00 00 
      00 00 00 00 80 3F 00 00 00 3F 00 00 00 00 00 00 
      00 00 00 00 00 00 00 00 00 3F 00 00 80 3F 
0834: 00 00 00 00 00 00 00 00 00 00 FA 3D 00 00 FA 3D :  0,0  /  x,x
      00 00 00 00 00 00 FA 3D 00 00 FA 3D 00 00 7A 3E :  0,x  /  x,2x
      00 00 00 00 00 00 7A 3E 00 00 FA 3D 00 80 BB 3E :  0,2x /  x,3x
      00 00 00 00 00 80 BB 3E 00 00 FA 3D 00 00 FA 3E :  0,3x /  x,4x
      00 00 00 00 00 00 FA 3E 00 00 FA 3D 00 40 1C 3F :  0,4x /  x,5x
      00 00 00 00 00 40 1C 3F 00 00 FA 3D 00 80 3B 3F :  0,5x /  x,6x
      00 00 FA 3D 00 00 00 00 00 00 7A 3E 00 00 FA 3D :  x,0  / 2x,x
      00 00 FA 3D 00 00 FA 3D 00 00 7A 3E 00 00 7A 3E :  x,x  / 2x,2x
      00 00 FA 3D 00 00 7A 3E 00 00 7A 3E 00 80 BB 3E :  x,2x / 2x,3x
      00 00 FA 3D 00 80 BB 3E 00 00 7A 3E 00 00 FA 3E :  x,3x / 2x,4x
      00 00 FA 3D 00 00 FA 3E 00 00 7A 3E 00 40 1C 3F :  x,4x / 2x,5x
      00 00 FA 3D 00 40 1C 3F 00 00 7A 3E 00 80 3B 3F :  x,5x / 2x,6x
      00 00 7A 3E 00 00 00 00 00 80 BB 3E 00 00 FA 3D : 2x,0  / 3x,x
      00 00 7A 3E 00 00 FA 3D 00 80 BB 3E 00 00 7A 3E : 2x,x  / 3x,2x
      00 00 7A 3E 00 00 7A 3E 00 80 BB 3E 00 80 BB 3E : 2x,2x / 3x,3x
      00 00 7A 3E 00 80 BB 3E 00 80 BB 3E 00 00 FA 3E : 2x,3x / 3x,4x
=> 16 subareas (3 rows with 6,6,4 parts)

3DFA0000 = 0.1220703125 = x
3E7A0000 = 0.244140625 = 2x
3EBB8000 = 0.3662109375 = 3x
3EFA0000 = 0.48828125 = 4x
3F1C4000 = 0.6103515625 = 5x
3F3B8000 = 0.732421875 = 6x

GPI 141

Offset:
ID  ID_Hex Offset   Length   width  height  asp.ratio  dimension   vdim hdim   dimh dec   dimv dec 
141 008D   001AD0   46       0100   00D5    256x213    3F80 3F55   3F55 3F80   1          0.8300313
           001AFE 480 bytes
Bytes:
1AD0: 8d 00 00 00 1e 00 00 01 00 00 d5 00 00 00 00 00 
      00 00 00 00 80 3f 00 00 55 3f 00 00 00 00 00 00 
      00 00 00 00 00 00 00 00 55 3f 00 00 80 3f 
1AFE: 00 00 00 00 00 00 00 00 00 00 FA 3D 00 00 FA 3D :  0,0  /  x,x
      00 00 00 00 00 00 FA 3D 00 00 FA 3D 00 00 7A 3E :  0,x  /  x,2x
      00 00 00 00 00 00 7A 3E 00 00 FA 3D 00 80 BB 3E :  0,2x /  x,3x
      00 00 00 00 00 80 BB 3E 00 00 FA 3D 00 00 FA 3E :  0,3x /  x,4x
      00 00 00 00 00 00 FA 3E 00 00 FA 3D 00 40 1C 3F :  0,4x /  x,5x
      00 00 00 00 00 40 1C 3F 00 00 FA 3D 00 80 3B 3F :  0,5x /  x,6x
      00 00 FA 3D 00 00 00 00 00 00 7A 3E 00 00 FA 3D :  x,0  / 2x,x
      00 00 FA 3D 00 00 FA 3D 00 00 7A 3E 00 00 7A 3E :  x,x  / 2x,2x
      00 00 FA 3D 00 00 7A 3E 00 00 7A 3E 00 80 BB 3E :  x,2x / 2x,3x
      00 00 FA 3D 00 80 BB 3E 00 00 7A 3E 00 00 FA 3E :  x,3x / 2x,4x
      00 00 FA 3D 00 00 FA 3E 00 00 7A 3E 00 40 1C 3F :  x,4x / 2x,5x
      00 00 FA 3D 00 40 1C 3F 00 00 7A 3E 00 80 3B 3F :  x,5x / 2x,6x
      00 00 7A 3E 00 00 00 00 00 80 BB 3E 00 00 FA 3D : 2x,0  / 3x,x
      00 00 7A 3E 00 00 FA 3D 00 80 BB 3E 00 00 7A 3E : 2x,x  / 3x,2x
      00 00 7A 3E 00 00 7A 3E 00 80 BB 3E 00 80 BB 3E : 2x,2x / 3x,3x
      00 00 7A 3E 00 80 BB 3E 00 80 BB 3E 00 00 FA 3E : 2x,3x / 3x,4x
      00 00 7A 3E 00 00 FA 3E 00 80 BB 3E 00 40 1C 3F : 2x,4x / 3x,5x
      00 00 7A 3E 00 40 1C 3F 00 80 BB 3E 00 80 3B 3F : 2x,5x / 3x,6x
      00 80 BB 3E 00 00 00 00 00 00 FA 3E 00 00 FA 3D : 3x,0  / 4x,x
      00 80 BB 3E 00 00 FA 3D 00 00 FA 3E 00 00 7A 3E : 3x,x  / 4x,2x
      00 80 BB 3E 00 00 7A 3E 00 00 FA 3E 00 80 BB 3E : 3x,2x / 4x,3x
      00 80 BB 3E 00 80 BB 3E 00 00 FA 3E 00 00 FA 3E : 3x,3x / 4x,4x
      00 80 BB 3E 00 00 FA 3E 00 00 FA 3E 00 40 1C 3F : 3x,4x / 4x,5x
      00 80 BB 3E 00 40 1C 3F 00 00 FA 3E 00 80 3B 3F : 3x,5x / 4x,6x
      00 00 FA 3E 00 00 00 00 00 40 1C 3F 00 00 FA 3D : 4x,0  / 5x,x
      00 00 FA 3E 00 00 FA 3D 00 40 1C 3F 00 00 7A 3E : 4x,x  / 5x,2x
      00 00 FA 3E 00 00 7A 3E 00 40 1C 3F 00 80 BB 3E : 4x,2x / 5x,3x
      00 00 FA 3E 00 80 BB 3E 00 40 1C 3F 00 00 FA 3E : 4x,3x / 5x,4x
      00 00 FA 3E 00 00 FA 3E 00 40 1C 3F 00 40 1C 3F : 4x,4x / 5x,5x
      00 00 FA 3E 00 40 1C 3F 00 40 1C 3F 00 80 3B 3F : 4x,5x / 5x,6x
=> 30 subareas; 5 rows with 6 parts each.

3DFA0000 = 0.1220703125 = x
and so on like seen in GPI 042.

GPH record format

In the special GPI file records an additional value occurs at offset 4-5 that contains the number of subareas used. It is 0 if no subdividing is done.
To the new extended GPI record format looks like this:

GPI033
meaning         hex          dec    offset
ID              21 00        33     00-01
subareas        00 00         0     04-05
width           40 00        64     06-07
height          20 00        32     10-11
dim-width org.  00 00 80 3F   1.0   18-21
dim-height org. 00 00 80 3F   1.0   22-25
dim-height      00 00 80 3F   1.0   38-41
dim-width       00 00 80 3F   1.0   42-45

GPI034
meaning         hex          dec    offset
ID              22 00        34     00-01
subareas        02 00         2     04-05
width           40 00        64     06-07
height          20 00        32     10-11
dim-width org.  00 00 80 3F   1.0   18-21
dim-height org. 00 00 00 3F   0.5   22-25
dim-height      00 00 00 3F   0.5   38-41
dim-width       00 00 80 3F   1.0   42-45

GPHOffsets
The subareas value is now included into the output file GPHOffsets.txt created by the new GPHRecords v0.912 programm, which is part of the GPHUpdater archive.
The output for GPI 33 and 34 will now look like

ID  ID_Hex Offset   Length   subs  width height  asp.ratio  dimension   vdim hdim    dimh dec   dimv dec    asp.quot  dim quot
33  0021   000648   46       0000  0100  0100    256x256    3F80 3F80   3F80 3F80    1          1           1         1
34  0022   000676   46       0002  0040  0020    64x32      3F80 3F00   3F00 3F80    1          0.5         2         2
           0006A4 32 bytes, 2 subareas

Unknown meanings
A few GPI IDs have got a value <> 0000 at offset 26-27.
ID 008 = 08 00 : 01 00
ID 077 = 4D 00 : 03 00
ID 116 = 74 00 : 03 00
ID 118 = 76 00 : 03 00
ID 267 = 0B 01 : 04 00
I am not yet aware of its meaning.


petrus' gpaedia files



Edited 8 time(s). Last edit at 10/11/2021 05:30PM by petrus.
Re: Hires GPI and the GPH file
Date: May 04, 2021 11:59AM
Posted by: Turbo Lover
Great new insights, thanks for sharing.



My Grand Prix 4 Files

I'm a total dick. How many people can say that?
Sorry, only registered users may post in this forum.

Click here to login

Maintainer: mortal, stephan | Design: stephan, Lo2k | Moderatoren: mortal, TomMK, Noog, stephan | Downloads: Lo2k | Supported by: Atlassian Experts Berlin | Forum Rules | Policy