1
0
mirror of https://github.com/Ylianst/MeshCommander synced 2025-12-06 06:03:20 +00:00

Added KVM 4bit color mode.

This commit is contained in:
Ylian Saint-Hilaire
2021-12-22 16:56:40 -08:00
parent 4e9695f752
commit 29e175c12e
2 changed files with 38 additions and 26 deletions

View File

@@ -49,6 +49,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
obj.useZLib = false; obj.useZLib = false;
obj.decimation = false; obj.decimation = false;
obj.graymode = false; obj.graymode = false;
obj.lowcolor = true;
// ###END###{DesktopInband} // ###END###{DesktopInband}
obj.mNagleTimer = null; // Mouse motion slowdown timer obj.mNagleTimer = null; // Mouse motion slowdown timer
@@ -178,8 +179,11 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
} else { } else {
// Gray scale modes // Gray scale modes
if (obj.bpp == 2) { obj.bpp = 1; } if (obj.bpp == 2) { obj.bpp = 1; }
if (obj.bpp == 1) obj.send(String.fromCharCode(0, 0, 0, 0, 8, 8, 0, 1) + ShortToStr(255) + ShortToStr(0) + ShortToStr(0) + String.fromCharCode(0, 0, 0, 0, 0, 0)); // Setup 8 bit black and white RGB800 if (obj.lowcolor == false) {
//if (obj.bpp == 1) obj.send(String.fromCharCode(0, 0, 0, 0, 8, 8, 0, 1) + ShortToStr(15) + ShortToStr(0) + ShortToStr(0) + String.fromCharCode(0, 0, 0, 0, 0, 0)); // Setup 4 bit black and white RGB400 obj.send(String.fromCharCode(0, 0, 0, 0, 8, 8, 0, 1) + ShortToStr(255) + ShortToStr(0) + ShortToStr(0) + String.fromCharCode(0, 0, 0, 0, 0, 0)); // Setup 8 bit black and white RGB800
} else {
obj.send(String.fromCharCode(0, 0, 0, 0, 8, 4, 0, 1) + ShortToStr(15) + ShortToStr(0) + ShortToStr(0) + String.fromCharCode(0, 0, 0, 0, 0, 0)); // Setup 4 bit black and white RGB400
}
} }
obj.state = 4; obj.state = 4;
@@ -327,6 +331,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
// Solid color tile // Solid color tile
if (obj.graymode) { if (obj.graymode) {
v = data[ptr++]; v = data[ptr++];
if (obj.lowcolor) { v = v << 4; }
obj.canvas.fillStyle = 'rgb(' + v + ',' + v + ',' + v + ')'; obj.canvas.fillStyle = 'rgb(' + v + ',' + v + ',' + v + ')';
} else { } else {
v = data[ptr++] + ((obj.bpp == 2) ? (data[ptr++] << 8) : 0); v = data[ptr++] + ((obj.bpp == 2) ? (data[ptr++] << 8) : 0);
@@ -470,6 +475,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
// ###END###{DesktopRotation} // ###END###{DesktopRotation}
if (obj.graymode) { if (obj.graymode) {
if (obj.lowcolor) { v = v << 4; }
obj.spare.data[pp] = obj.spare.data[pp + 1] = obj.spare.data[pp + 2] = v; obj.spare.data[pp] = obj.spare.data[pp + 1] = obj.spare.data[pp + 2] = v;
} else { } else {
obj.spare.data[pp] = v & 224; obj.spare.data[pp] = v & 224;
@@ -499,6 +505,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
function _setPixel8run(v, p, run) { function _setPixel8run(v, p, run) {
if (obj.graymode) { if (obj.graymode) {
var pp = (p << 2); var pp = (p << 2);
if (obj.lowcolor) { v = v << 4; }
while (--run >= 0) { obj.spare.data[pp] = obj.spare.data[pp + 1] = obj.spare.data[pp + 2] = v; pp += 4; } while (--run >= 0) { obj.spare.data[pp] = obj.spare.data[pp + 1] = obj.spare.data[pp + 2] = v; pp += 4; }
} else { } else {
var pp = (p << 2), r = (v & 224), g = ((v & 28) << 3), b = (_fixColor((v & 3) << 6)); var pp = (p << 2), r = (v & 224), g = ((v & 28) << 3), b = (_fixColor((v & 3) << 6));

View File

@@ -1364,17 +1364,7 @@
<div id="dialog7" style="margin:auto;margin:3px"> <div id="dialog7" style="margin:auto;margin:3px">
<br> <br>
<div style='height:26px'> <div style='height:26px'>
<select id="idx_d7desktopmode" style="float:right;width:200px"> <select id="idx_d7desktopmode" style="float:right;width:200px"></select>
<!-- Flags: 1 = RLE, 2 = 16bit, 4 = Gray, 8 = ZLib -->
<option id="d7exm1" value="5">RLE8G, Gray</option>
<option value="1">RLE8, Color</option>
<option value="3">RLE16, Color</option>
<option id="d7exm2" value="13">ZRLE8G, Compressed Gray</option>
<option id="d7exm3" value="9">ZRLE8, Compressed Color</option>
<option id="d7exm4" value="11">ZRLE16, Compressed Color</option>
<option value="0">RAW8, Color</option>
<option value="2">RAW16, Color</option>
</select>
<div>Image Encoding</div> <div>Image Encoding</div>
</div> </div>
<div style="height:80px"> <div style="height:80px">
@@ -8354,14 +8344,16 @@
if ((skipConsent !== true) && (amtversion > 5) && (amtsysstate != null) && (amtsysstate['IPS_OptInService'] != null) && (amtsysstate['IPS_OptInService'].response != undefined) && (amtsysstate['IPS_OptInService'].response['OptInRequired'] == 0xFFFFFFFF)) { if ((skipConsent !== true) && (amtversion > 5) && (amtsysstate != null) && (amtsysstate['IPS_OptInService'] != null) && (amtsysstate['IPS_OptInService'].response != undefined) && (amtsysstate['IPS_OptInService'].response['OptInRequired'] == 0xFFFFFFFF)) {
connectDesktopConsent = true; amtstack.Get('IPS_OptInService', powerActionResponse0, 0, 1); return; // User consent always required, ask for it before KVM. connectDesktopConsent = true; amtstack.Get('IPS_OptInService', powerActionResponse0, 0, 1); return; // User consent always required, ask for it before KVM.
} }
// Encoding Flags: 1 = RLE, 2 = 16bit, 4 = Gray, 8 = ZLib, 16 = Decimation // Encoding Flags: 1 = RLE, 2 = 16bit, 4 = Gray, 8 = ZLib, 16 = 4bit Color
desktop.m.useRLE = ((desktopsettings.encflags & 1) != 0); desktop.m.useRLE = ((desktopsettings.encflags & 1) != 0);
desktop.m.bpp = (desktopsettings.encflags & 2) ? 2 : 1; desktop.m.bpp = (desktopsettings.encflags & 2) ? 2 : 1;
if ((amtversion > 15) && (amtsysstate != null) && (amtsysstate['IPS_KVMRedirectionSettingData'] != null) && (amtsysstate['IPS_KVMRedirectionSettingData'].response)) { if ((amtversion > 15) && (amtsysstate != null) && (amtsysstate['IPS_KVMRedirectionSettingData'] != null) && (amtsysstate['IPS_KVMRedirectionSettingData'].response)) {
desktop.m.lowcolor = amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported'] && ((desktopsettings.encflags & 16) != 0);
desktop.m.graymode = amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported'] && ((desktopsettings.encflags & 4) != 0); desktop.m.graymode = amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported'] && ((desktopsettings.encflags & 4) != 0);
desktop.m.useZLib = amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported'] && ((desktopsettings.encflags & 8) != 0); desktop.m.useZLib = amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported'] && ((desktopsettings.encflags & 8) != 0);
desktop.m.decimation = amtsysstate['IPS_KVMRedirectionSettingData'].response['InitialDecimationModeForLowRes'] && desktopsettings.decimation; desktop.m.decimation = amtsysstate['IPS_KVMRedirectionSettingData'].response['InitialDecimationModeForLowRes'] && desktopsettings.decimation;
} else { } else {
desktop.m.lowcolor = false;
desktop.m.graymode = false; desktop.m.graymode = false;
desktop.m.useZLib = false; desktop.m.useZLib = false;
desktop.m.decimation = false; desktop.m.decimation = false;
@@ -8647,23 +8639,36 @@
if (desktopsettings.scaling) { d7bitmapscaling.value = desktopsettings.scaling; } if (desktopsettings.scaling) { d7bitmapscaling.value = desktopsettings.scaling; }
QV('d7softkvmsettings', amtversion >= 12); QV('d7softkvmsettings', amtversion >= 12);
// ###END###{DesktopInband} // ###END###{DesktopInband}
var encflags = desktopsettings.encflags; // Flags: 1 = RLE, 2 = 16bit, 4 = Gray, 8 = ZLib var encflags = desktopsettings.encflags; // Flags: 1 = RLE, 2 = 16bit, 4 = Gray, 8 = ZLib, 16 = 4bit Color
var x = '';
if ((amtversion > 15) && (amtsysstate != null) && (amtsysstate['IPS_KVMRedirectionSettingData'] != null) && (amtsysstate['IPS_KVMRedirectionSettingData'].response)) { if ((amtversion > 15) && (amtsysstate != null) && (amtsysstate['IPS_KVMRedirectionSettingData'] != null) && (amtsysstate['IPS_KVMRedirectionSettingData'].response)) {
if (!amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported']) { encflags = encflags & 11; } // Remove grayscale if (!amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported']) { encflags = encflags & 11; } // Remove grayscale and lowcolor
if (!amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported']) { encflags = encflags & 7; } // Remove zlib if (!amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported']) { encflags = encflags & 23; } // Remove zlib
QV('d7exm1', amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported']); if (amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported']) {
QV('d7exm2', amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported'] && amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported']); x += '<option id="d7exm1" value=21>' + "RLE4G, 16 Grays" + '</option>';
QV('d7exm3', amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported']); x += '<option id="d7exm2" value=5>' + "RLE8G, 256 Grays" + '</option>';
QV('d7exm4', amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported']); }
x += '<option value=1>' + "RLE8, 256 Colors" + '</option>';
x += '<option value=3>' + "RLE16, 64k Colors" + '</option>';
if (amtsysstate['IPS_KVMRedirectionSettingData'].response['ZlibControlSupported']) {
if (amtsysstate['IPS_KVMRedirectionSettingData'].response['GrayscalePixelFormatSupported']) {
x += '<option id="d7exm3" value=29>' + "ZRLE4G, Compressed Gray" + '</option>';
x += '<option id="d7exm4" value=13>' + "ZRLE8G, Compressed Gray" + '</option>';
}
x += '<option id="d7exm5" value=9>' + "ZRLE8, Compressed Color" + '</option>';
x += '<option id="d7exm6" value=11>' + "ZRLE16, Compressed Color" + '</option>';
}
QV('d7decimationspan', amtsysstate['IPS_KVMRedirectionSettingData'].response['InitialDecimationModeForLowRes'] > 0); QV('d7decimationspan', amtsysstate['IPS_KVMRedirectionSettingData'].response['InitialDecimationModeForLowRes'] > 0);
} else { } else {
encflags = encflags & 3; // Remove gray & zlib flags (4 and 8), keep 1 & 2 encflags = encflags & 3; // Remove gray & zlib flags (4 and 8), keep 1 & 2
QV('d7exm1', false); x += '<option value=1>' + "RLE8, 256 Colors" + '</option>';
QV('d7exm2', false); x += '<option value=3>' + "RLE16, 64k Colors" + '</option>';
QV('d7exm3', false); QV('d7decimationspan', false);
QV('d7exm4', false);
QV('d7decimationspan', false)
} }
x += '<option value=0>' + "RAW8, 256 Colors" + '</option>';
x += '<option value=2>' + "RAW16, 16k Colors" + '</option>';
QH('idx_d7desktopmode', x);
idx_d7desktopmode.value = encflags; idx_d7desktopmode.value = encflags;
// ###BEGIN###{DesktopFocus} // ###BEGIN###{DesktopFocus}
QV('idx_deskFocusBtn', desktopsettings.showfocus); QV('idx_deskFocusBtn', desktopsettings.showfocus);