Log in

View Full Version : Radar hacking


Sniper297
09-30-14, 09:31 PM
Looking for two things here;

1. Which file or files controls the color of the PPI scope, for example if you want to change the display from red to green?
2. Which file or files controls the depth at which the radar automatically shuts down?

Sniper297
10-01-14, 07:29 PM
Nope.

\Data\Library\USSubParts\Sensors_sub_US.sim

has a lot of data, but nothing I can find which controls the cutoff depth.

\Data\Interior\NSS_Salmon\NSS_Salmon_CT.sim

also has a lot of data, but nothing that looks like RGB values.

Sniper297
10-08-14, 09:13 PM
Nobody knows even how to change the color from red to green? Possibly the depth cutout is hard coded into an EXE file somewhere, but it's hard to believe there isn't some file with RGB values for the display. The DDS files are actually green so there must be a shader someplace.

ETR3(SS)
10-09-14, 11:51 AM
To answer your second question, try the units cfg file. Specifically the surface depth entry. It's been some time since I've worked on that aspect but I believe that's where you want to look.

Sniper297
10-09-14, 05:28 PM
Not finding a units cfg file here.

ETR3(SS)
10-10-14, 12:39 AM
Sorry, NSS_Sargo.cfg. That make more sense?

Sniper297
10-10-14, 11:28 AM
Makes sense but no joy.

\Data\Submarine\NSS_Sargo\NSS_Sargo.cfg

[Unit]
ClassName=SSSargo
3DModelFileName=data/Submarine/NSS_Sargo/NSS_Sargo
HumanPlayable=YES
Interior=data/Interior/NSS_Salmon/NSS_Salmon
UnitType=200
MaxSpeed=21
MaxSpeedSubmerged=8.75
Length=94.6404
Width=8.1788
RenownAwarded=130

[Salvo]
1=1,3,2,4
2=1,2,4
3=1,3,4
4=1,4
5=2,3
6=1,3
7=2,4

[Properties]
PeriscopeDepth=16.7;meters
SnorkelDepth=15;meters
CrashDepth=40;meters
MaxDepth=100;meters
SurfaceDepth=5.061;meters
TorpLaunchMaxDepth=30;meters
StormConditions=9,0.1;max wind speed [m/s], max rain intensity [0,1]

[EngineProperties]
AllStop=0.00
AheadSlow=0.40
AheadOneThird=0.57
AheadStandard=0.80
AheadFull=0.94
AheadFlank=1.00
BackSlow=-0.26
BackStandard=-0.40
BackFull=-0.53
BackEmergency=-0.66

Nothing in there about radar. :-?

Sniper297
04-20-15, 06:15 PM
Well, in the library\us subparts\Sensors_sub_US.sim after comparing ID numbers to parent IDs in the dat file, I found the salmon/sargo SJ1 radar specs. Got a min and max height and a min and max sensor height, changing the min sensor height to -50 or whatever seems to have no effect. I know that number 55 in that file is the correct one because in addition to checking the ID with the parent ID I changed the sweep period from 20 to 6, and ingame the radar sweep takes 6 seconds instead of 20 for a complete rotation. I'd leave it that way (IIRC modern radar PPI scopes have a six second sweep) but then the sweep arc has to be changed from 9 degrees to 1 so it don't look weird, and the spike on the A scope don't look right either.

Questions not either self explanatory or explained by the descriptions;

RPMDetLevel=0.0 - Detection level at percentage of maximum RPM (between 0 and 1).

SkipSweep=true - When sweeping sensor skip invalid sectors.

Okay, but what do those mean, what do they affect?

Sniper297
05-01-15, 09:41 PM
I'm keeping this thread going in the hope that someone will eventually know the answer to one of these two questions. Automatic shutoff depth for the SJ radar is 40 feet, since I got one of those flat calms today I was able to test this - the SJ antenna doesn't actually go under on the SARGO until a depth of 50 feet. Makes no sense that the SJ cuts off when the antenna is still 10 feet above the water, makes even less sense that the crew AI doesn't have enough brainpower to turn it back on automatically when it keeps cutting out in heavy seas, and makes zero sense that there isn't a simple way to adjust the cutoff depth.

aanker
05-04-15, 02:12 PM
Looking for two things here;

1. Which file or files controls the color of the PPI scope, for example if you want to change the display from red to green?
2. ......
Edit:
Hitman, Nisgeis, Frederf, Anvart & Capt Scurvy all came to mind on this radar topic.

I must remember: Stock PPI is red, Stock PPI is red, Stock PPI is red, Stock PPI is red, ....

I'm guessing the red green 'switch' is in the Conning Tower Interior *.dat and/or *.sim files for each boat?

Sniper297
05-04-15, 03:00 PM
"in RFB the A-Scope is green and his PPI red"

In the stock 1.4 game the A-scope is green and the PPI is red, no different from RFB. I have a mod that adds range rings, but it's still red.

https://scontent-ord.xx.fbcdn.net/hphotos-xap1/t31.0-8/11194661_918301518214129_9115434201199390191_o.jpg

I labeled them to avoid confusion because the buttons on the bottom are reversed, "Go to PPI radar" takes you to the A-scope, "Go to A-scope" takes you to the PPI. Fortunately the main radar button takes you to the PPI when double clicked. (This image is an interior lighting mod for the conning tower plus a camera hack for the conning tower interior view, I haven't uploaded either yet since I haven't bought 1.5 yet.)

I understand how colors work, 255, 0, 0 is red, change to 255, 255, 0 and you get yellow. Problem is I can't find anything in any file that has radar color data in it.

aanker
05-04-15, 07:01 PM
"in RFB the A-Scope is green and his PPI red"

In the stock 1.4 game the A-scope is green and the PPI is red, no different from RFB. I have a mod that adds range rings, but it's still red.

I labeled them to avoid confusion because the buttons on the bottom are reversed, "Go to PPI radar" takes you to the A-scope, "Go to A-scope" takes you to the PPI. Fortunately the main radar button takes you to the PPI when double clicked.
I recall that backward "Go to PPI radar" takes you to the A-scope, "Go to A-scope" takes you to the PPI." issue. The fix in menu.txt was simple.

OK, it's been so long since I saw Stock - That is my only excuse .... I just now fired up Stock 1.5 plus looked at screenshots from earlier versions, and sure enough there's a RED PPI. Sorry........

TorpX
05-04-15, 08:50 PM
Questions not either self explanatory or explained by the descriptions;

RPMDetLevel=0.0 - Detection level at percentage of maximum RPM (between 0 and 1).

SkipSweep=true - When sweeping sensor skip invalid sectors.

Okay, but what do those mean, what do they affect?

I can only take a guess, but I think the first is related to detection being a function of how fast the beam is sweeping by.

The second, I think is for the display to have the sweep arm (whatever it is called) skipping dead zones that the unit cannot 'see'; like with the German sets mounted rigidly on tower?

I have no idea how to keep radar from turning off in high waves. I would check the 3d models of the radar masts themselves, to see if there are any interesting nodes there, but surely somebody has already done this (?). I know you are not the only one to notice this problem.

Sniper297
05-05-15, 12:24 AM
Probably a reasonable reasoning. Percentage of maximum RPM could easily be a feature that was never finished (no control over sweep RPM in game, the only way to adjust it is by hacking the file) so they disabled it by setting it to zero.

Skip sweep who knows, in the real world there would be a huge blob at 180 minimum range if one of the periscopes was raised. I'll have to try setting it to FALSE and see if it replicates that effect.

3d models of the radar masts, I've looked at assorted 3D models in S3d without the slightest idea what I'm looking at - every time I've ever tried to learn even the most simple modeling program it beats me up and takes my lunch money. :dead:

aanker
05-05-15, 02:45 PM
Nobody knows even how to change the color from red to green? Possibly the depth cutout is hard coded into an EXE file somewhere, but it's hard to believe there isn't some file with RGB values for the display. The DDS files are actually green so there must be a shader someplace.
I knew I had a green PPI scope. Check this old topic by Mrahh:
http://www.subsim.com/radioroom/showthread.php?t=115207

In the mod are Radar.dds, ppiCircles.dds, & in the Shaders folder is a fix for PPIRadarPS.fx by Anvart. The CT *.sims were included in a version 1.21.
Readme:
RadarSweep.7z
Author Anvart.
This mod is for SH4 game ver. 1.2.
This mod fix mistake in script shader file (PPIRadarPS.fx).
Now you can see stock grid on radar display.
On a plan of developers the grid is made of a celluloid film with grid figure and it is put from above on the radar display.
I also have cleaned word "Range:" from the radar display (in SHControllers.act file).
In this mod the size and the form of radar markers also are changed. Main marker is small circle, additional markers are
the slanting cross and the cross.

"SHControllers.act file must to be in main SH4 folder.".....If these mods could be reverse engineered to see what was changed, it might be possible for you to turn the PPI from red to green in v1.5.

http://i174.photobucket.com/albums/w96/Vinemys/Num1Large.jpg

Screenshot from:
http://www.subsim.com/radioroom/showthread.php?t=115207&page=6

Sniper297
05-05-15, 06:58 PM
No mods in there so far, I'm up to page 15 and every link is a 404. The one post where he mentions a hack in the PPIRadarPS.fx file is a string:

So here's the change (orange is my addition) :

float4 f=tex2D(fadetex,In.Tex0)+tex2D(grid,In.Tex1);


I don't have in mine.


float Fade:register(c0);
float Intensity:register(c1);

sampler map: register(s0);
sampler grid: register(s1);
sampler noise: register(s2);
sampler fadetex: register(s3);

struct PS_IN
{
float2 Tex0 : TEXCOORD0;
float2 Tex1 : TEXCOORD1;
float2 Tex2 : TEXCOORD2;
float2 Tex3 : TEXCOORD3;
};


float4 main( PS_IN In ) : COLOR
{
float gchan;
float bchan;
float mixedchan;
float4 blur = 0;

blur = tex2D(fadetex, In.Tex0);
blur.r = 0;

gchan = blur.g;
bchan = blur.b;

blur.rgb =0;
mixedchan = (gchan+bchan) / 2;
blur.g = mixedchan;

int N = 7;
float R = 0.08;
float Rcolor = 0.005;
blur = tex2D(map, In.Tex0);
float4 color = tex2D(fadetex,In.Tex0);

float4 ret=color;//+blur*0.25;

bchan = ret.b;

ret.g += bchan;
ret.b -= bchan;
ret.rb=pow(ret.g,8);
ret.rgb = ret.grb;
return ret;
}

I assume there's some way to edit this to replace R with G, but it's all Greek to me. I tried the PPIcircles.dds and radar.dds files when I first started looking at this, but one is already green and the other is blue. There's no way to combine blue and green to make red, so the color has to be somewhere in that PPIRadarPS.fx file. The CT*.sim files you mentioned (can't confirm this since all the filefront / rapidshare / whatever links are history) are probably range adjustments or something, if the color change preceded 1.21 it's unlikely to be in anything that wasn't in the first version. I'll look at it anyway;

LightColor = R1, G209, B12

That's for the sonar indicator light, not the radar, but it is the kind of color adjustment that SHOULD HAVE been used for the radar someplace. Why in the world they would use RGB values in sim files for one piece of equipment and C code in a .fx file for another is beyond me, but it looks to me like that's what they did. What the SHControllers.act has to do with anything is a mystery but I'll look at that with a hex editor while I'm at it.

Sniper297
05-05-15, 11:43 PM
Still don't understand how this works, but a direct substitution of R for G and G for R in the PPIRadarPS.fx file works;



float Fade:register(c0);
float Intensity:register(c1);

sampler map: register(s0);
sampler grid: register(s1);
sampler noise: register(s2);
sampler fadetex: register(s3);

struct PS_IN
{
float2 Tex0 : TEXCOORD0;
float2 Tex1 : TEXCOORD1;
float2 Tex2 : TEXCOORD2;
float2 Tex3 : TEXCOORD3;
};


float4 main( PS_IN In ) : COLOR
{
float rchan;
float bchan;
float mixedchan;
float4 blur = 0;

blur = tex2D(fadetex, In.Tex0);
blur.g = 0;

rchan = blur.r;
bchan = blur.b;

blur.rgb =0;
mixedchan = (rchan+bchan) / 2;
blur.r = mixedchan;

int N = 7;
float G = 0.08;
float Gcolor = 0.005;
blur = tex2D(map, In.Tex0);
float4 color = tex2D(fadetex,In.Tex0);

float4 ret=color;//+blur*0.25;

bchan = ret.b;

ret.r += bchan;
ret.b -= bchan;
ret.gb=pow(ret.g,8);
ret.rgb = ret.grb;
return ret;
}

Colored letters are what I changed, the color shows what letter was originally there - swap r and g except where it was obvious it shouldn't be swapped. (rgb is the correct order for programming, so grb might throw a wonky into the code, dunno why the ret.rgb = ret.grb string but it didn't look like something that needed to be changed since it was a straight reversal)

And what that gets me is this;

https://scontent-ord.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/1509158_918817514829196_7877300624486129334_n.jpg? oh=45405a8374c4d9fed36f387d08217218&oe=55CE170F

Gonna make a backup of that and see what I can do to tweak it. Rather than fooling around like I did I would suggest just copying the entire code as I pasted it above, unless 1.5 differs from the original that I have.

aanker
05-06-15, 11:54 AM
Cool, nice detective work!

Sniper297
05-06-15, 01:11 PM
Main problem remaining is the sweep is pink, gotta figure out how to make that green.

TorpX
05-06-15, 09:09 PM
Yes, good work.

It's all greek to me.

Sniper297
05-10-15, 05:05 PM
Irritations still remaining, in addition to the blasted thing shutting off in high seas and not turning back on automatically when the wave passes over (breaking over the top of the periscope shears on a regular basis? Seriously?) we got the automatic focus. Go to the radar view and it automatically stops sweeping and switches to focus, how to disable that? In the first place that's not how focus works, it would sweep back and forth on a 30 or 60 degree arc, not just stop dead. What I want is to look at the radar display without stopping the sweep, which is impossible because it defaults to stopping the sweep every time I look at it. Gotta be a true/false value in one of these files somewhere.

aanker
05-10-15, 05:33 PM
Irritations still remaining, i.........
What I want is to look at the radar display without stopping the sweep, which is impossible because it defaults to stopping the sweep every time I look at it. Gotta be a true/false value in one of these files somewhere.
If you find it there's a finders fee - I'm buyin' at the Royal Hawaiian. I think it's hard-coded.