Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): chroma only during a match, a switch in options, Z row
Olcay Seygan08d38866978e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 43c8024dc..8912d5f25 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -712,7 +712,9 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- The two arrows carry your selection: how hurt it is, green through to red, and what rank the unit in front of it holds.- The mousepad is your money, a lamp per thousand credits.- The mouse under your hand pulses red while the base is under fire, along with the strip down the left edge of the keyboard, and settles four seconds after the last hit. The keys themselves are left alone. An alarm that washes the whole board arrives at the one moment you most need to read the bar, and buries it.-- Nothing to install and nothing to turn on. If Synapse is running it is there; if it is not, the game never mentions it. Options has a switch, and `-nochroma` takes it out of a timed run.+- Nothing to install and nothing to turn on. If Synapse is running it is there; if it is not, the game never mentions it, and a Synapse you start mid-session is picked up within five seconds. The switch is a check box on Options > Controls, and `-nochroma` takes it out of a timed run.+- It is only there while you play. The main menu, the lobby and the score screen leave the board to whatever Synapse draws on your desktop, and so does turning the box off mid-match.+- The command bar's second row, Z through M, used to light the key one to the left of the one that presses it, and Z lit nothing on most boards. Every key of that row now lights itself.## The options screen has pagesdiff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 452eba038..bd5972e21 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -870,6 +870,14 @@ TOOLTIP:WasdCamera"W A S D move the camera. F attacks, G stops, H attack-moves, J guards and K holds position, and the command bar's top row reads Q E R T Y U I. Modern input only."END+GUI:ChromaLighting+"Razer Chroma Lighting"+END++TOOLTIP:ChromaLighting+"During a match, a Razer keyboard, mouse and mousepad show the command bar, power, superweapons and money. In the menus Synapse keeps its own lighting."+END+GUI:OrderLines"Order Lines"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex bf4a60022..2d630741b 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15429,6 +15429,14 @@ TOOLTIP:WasdCamera"W A S D kamerayı gezdirir. F saldırır, G durdurur, H saldırarak ilerler, J gözcü koyar, K konumu korur; komut çubuğunun üst sırası Q E R T Y U I olur. Yalnızca Modern girişte."END+GUI:ChromaLighting+"Razer Chroma Işıkları"+END++TOOLTIP:ChromaLighting+"Maç sırasında Razer klavye, fare ve mousepad komut çubuğunu, elektriği, süper silahları ve parayı gösterir. Menülerde Synapse kendi ışığını yakar."+END+GUI:OrderLines"Emir Çizgileri"ENDdiff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wndindex 5cf260ab4..ca012678a 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd@@ -7520,6 +7520,53 @@ WINDOWIMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;END+ CHILD+ WINDOW+ WINDOWTYPE = CHECKBOX;+ SCREENRECT = UPPERLEFT: 536 266, BOTTOMRIGHT: 760 290, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckChromaLighting";+ STATUS = ENABLED+IMAGE+BORDER;+ STYLE = CHECKBOX+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;+ HEADERTEMPLATE = "MinorTitle";+ TOOLTIPTEXT = "TOOLTIP:ChromaLighting";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:ChromaLighting";+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ ENDENDALLCHILDRENENDCHILDdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ChromaKeyboard.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ChromaKeyboard.hindex 0d3590e23..80e82109b 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ChromaKeyboard.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ChromaKeyboard.h@@ -23,8 +23,9 @@// the navigation cluster, superweapons on the numpad, production along the// bottom, and money on the mousepad. Talks to the Chroma REST server on// localhost, so it needs no SDK header, no import library and no DLL beside the-// exe: with Synapse absent the first request fails and the whole thing goes-// quiet for the run.+// exe: with Synapse absent the request fails and is tried again every few+// seconds. The session is held only during a match with the option on; in the+// menus the board is left to Synapse./////////////////////////////////////////////////////////////////////////////////diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cppindex 888668e20..2d79b7cc3 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp@@ -244,9 +244,9 @@ const OptionDef TheOptionCatalog[] =get_m_showAllyCursors, set_m_showAllyCursors },// The match on Razer hardware: the command bar on the letter keys, power on the digits,- // superweapons on the numpad, money on the mousepad. Off gives the keyboard back to whatever- // Synapse wants to do with it, and takes the worker thread with it.- { "ChromaLighting", "", "",+ // superweapons on the numpad, money on the mousepad. Only during a match; off, and in every+ // menu, the keyboard goes back to whatever Synapse wants to do with it. On Options > Controls.+ { "ChromaLighting", OPT_WND( "CheckChromaLighting" ), "GUI:ChromaLighting",OPTION_BOOL, APPLY_LIVE, 0, 1,get_m_chromaLighting, set_m_chromaLighting },diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cppindex e62ceae87..64a569cde 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp@@ -125,13 +125,14 @@ static const Int COLOR_GOLD = 0x00D7FF;//-----------------------------------------------------------------------------// The keyboard grid, zone by zone. Column zero is the strip down the left of// the board and column one is escape, tab, caps and shift, so the typing rows-// all start at two. Row zero is the function keys.+// start at two, except Z's, which starts at three behind the ISO key. Row zero+// is the function keys.//-----------------------------------------------------------------------------static const char *CHROMA_KEY_ROWS[] = { "1234567890", "qwertyuiop", "asdfghjkl", "zxcvbnm" };static const Int CHROMA_KEY_ROW_COUNT = 4;+static const Int CHROMA_KEY_FIRST_COLUMNS[ CHROMA_KEY_ROW_COUNT ] = { 2, 2, 2, 3 };static const Int CHROMA_POWER_ROW = 0;static const Int CHROMA_FIRST_HOTKEY_ROW = 1;-static const Int CHROMA_KEY_FIRST_COLUMN = 2;static const Int CHROMA_KEY_FIRST_ROW = 1;static const Int MATCH_STATE_ROW = 0;@@ -209,8 +210,14 @@ static Int s_pendingCells[ CHROMA_CELLS ];static Bool s_workerRunning = FALSE;static Bool s_disabled = FALSE;static volatile LONG s_workerShouldStop = 0;+/// Whether the hardware is ours right now: the option is on and a match is being+/// played. Anywhere else the session is closed and Synapse lights the board.+static volatile LONG s_sessionWanted = 0;static HANDLE s_workerThread = NULL;+/// How long the worker waits before asking an absent Chroma server again.+static const DWORD CHROMA_RETRY_MS = 5000;+//-----------------------------------------------------------------------------// Pure helpers.//-----------------------------------------------------------------------------@@ -223,7 +230,7 @@ Int chromaCellForKey( char key ){if( keys[ column ] == key )return (CHROMA_KEY_FIRST_ROW + row) * KEYBOARD_COLUMNS- + CHROMA_KEY_FIRST_COLUMN + column;+ + CHROMA_KEY_FIRST_COLUMNS[ row ] + column;}}return -1;@@ -918,68 +925,119 @@ static void chromaBuildDeviceBody( const ChromaDevice &device, const Int *cells,}//-----------------------------------------------------------------------------+/** Open a session and connect to the address it names, or NULL when there is no+ * Chroma server to open one with. */+static HINTERNET chromaConnect( HINTERNET internet, char *sessionRoot, Int sessionRootBytes )+{+ HINTERNET handshake = InternetConnectA( internet, CHROMA_HOST, CHROMA_PORT, NULL, NULL,+ INTERNET_SERVICE_HTTP, 0, 0 );+ if( handshake == NULL )+ return NULL;++ char sessionHost[ 64 ];+ INTERNET_PORT sessionPort = 0;+ const Bool opened = chromaOpenSession( handshake, sessionHost, sizeof( sessionHost ),+ &sessionPort, sessionRoot, sessionRootBytes );+ InternetCloseHandle( handshake );+ if( !opened )+ return NULL;++ HINTERNET connection = InternetConnectA( internet, sessionHost, sessionPort, NULL, NULL,+ INTERNET_SERVICE_HTTP, 0, 0 );+ if( connection != NULL )+ DEBUG_LOG(( "Chroma: session open on %s:%d%s\n", sessionHost, (Int)sessionPort, sessionRoot ));+ return connection;+}++//-----------------------------------------------------------------------------+/** Hand the hardware back. Without the DELETE it holds the last frame sent+ * until the session times out, ten seconds of a battle on a board in a menu. */+static void chromaDisconnect( HINTERNET connection, const char *sessionRoot )+{+ chromaRequest( connection, "DELETE", sessionRoot, "", NULL, 0 );+ InternetCloseHandle( connection );+ DEBUG_LOG(( "Chroma: session closed, the board is Synapse's again\n" ));+}++//-----------------------------------------------------------------------------+/** The session is held only while s_sessionWanted says so, which is while a+ * match is being played with the option on. Out of a match the board goes+ * back to whatever Synapse draws for the desktop. */static DWORD WINAPI chromaWorkerMain( LPVOID ){// Big enough for the largest device's cells as ten-digit numbers, plus the// punctuation and the effect name.char body[ KEYBOARD_CELLS * 12 + 128 ];- char sessionHost[ 64 ];char sessionRoot[ 128 ];char devicePath[ CHROMA_DEVICE_COUNT ][ 160 ];- INTERNET_PORT sessionPort = 0;Int sent[ CHROMA_CELLS ];Int cells[ CHROMA_CELLS ];HINTERNET internet = InternetOpenA( "ZeroHourReforged", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0 );- HINTERNET handshake = NULL;- if( internet != NULL )- {- DWORD timeout = CHROMA_TIMEOUT_MS;- InternetSetOptionA( internet, INTERNET_OPTION_CONNECT_TIMEOUT, &timeout, sizeof( timeout ) );- InternetSetOptionA( internet, INTERNET_OPTION_SEND_TIMEOUT, &timeout, sizeof( timeout ) );- InternetSetOptionA( internet, INTERNET_OPTION_RECEIVE_TIMEOUT, &timeout, sizeof( timeout ) );- handshake = InternetConnectA( internet, CHROMA_HOST, CHROMA_PORT, NULL, NULL,- INTERNET_SERVICE_HTTP, 0, 0 );- }+ if( internet == NULL )+ return 0;- // ponytail: one attempt at startup. Synapse started after the game is not- // picked up; retrying on a timer would mean a second piece of state to own.- Bool opened = handshake != NULL- && chromaOpenSession( handshake, sessionHost, sizeof( sessionHost ),- &sessionPort, sessionRoot, sizeof( sessionRoot ) );- if( handshake != NULL )- InternetCloseHandle( handshake );+ DWORD timeout = CHROMA_TIMEOUT_MS;+ InternetSetOptionA( internet, INTERNET_OPTION_CONNECT_TIMEOUT, &timeout, sizeof( timeout ) );+ InternetSetOptionA( internet, INTERNET_OPTION_SEND_TIMEOUT, &timeout, sizeof( timeout ) );+ InternetSetOptionA( internet, INTERNET_OPTION_RECEIVE_TIMEOUT, &timeout, sizeof( timeout ) );HINTERNET connection = NULL;- if( opened )- connection = InternetConnectA( internet, sessionHost, sessionPort, NULL, NULL,- INTERNET_SERVICE_HTTP, 0, 0 );- if( connection == NULL )- {- DEBUG_LOG(( "Chroma: no Razer server on %s:%d, hardware lighting is off for this run\n",- CHROMA_HOST, (Int)CHROMA_PORT ));- if( internet != NULL )- InternetCloseHandle( internet );- return 0;- }- for( Int device = 0; device < CHROMA_DEVICE_COUNT; ++device )- {- _snprintf( devicePath[ device ], sizeof( devicePath[ device ] ), "%s/%s",- sessionRoot, CHROMA_DEVICES[ device ].endpoint );- devicePath[ device ][ sizeof( devicePath[ device ] ) - 1 ] = 0;- }- DEBUG_LOG(( "Chroma: session open on %s:%d%s\n", sessionHost, (Int)sessionPort, sessionRoot ));-- memset( sent, 0, sizeof( sent ) );+ Bool everAttempted = FALSE;+ Bool absenceLogged = FALSE;+ DWORD lastAttemptMs = 0;DWORD lastSendMs = 0;Bool answersLogged = FALSE;while( InterlockedCompareExchange( &s_workerShouldStop, 0, 0 ) == 0 ){+ const DWORD nowMs = timeGetTime();+ const Bool wanted = InterlockedCompareExchange( &s_sessionWanted, 0, 0 ) != 0;+ if( !wanted )+ {+ if( connection != NULL )+ {+ chromaDisconnect( connection, sessionRoot );+ connection = NULL;+ }+ Sleep( CHROMA_SEND_INTERVAL_MS );+ continue;+ }++ if( connection == NULL )+ {+ // Synapse may be started, or restarted, after the game, so an absent+ // server is asked again every few seconds rather than given up on.+ if( everAttempted && nowMs - lastAttemptMs < CHROMA_RETRY_MS )+ {+ Sleep( CHROMA_SEND_INTERVAL_MS );+ continue;+ }+ everAttempted = TRUE;+ lastAttemptMs = nowMs;+ connection = chromaConnect( internet, sessionRoot, sizeof( sessionRoot ) );+ if( connection == NULL )+ {+ if( !absenceLogged )+ DEBUG_LOG(( "Chroma: no Razer server on %s:%d, asking again every %d ms\n",+ CHROMA_HOST, (Int)CHROMA_PORT, (Int)CHROMA_RETRY_MS ));+ absenceLogged = TRUE;+ Sleep( CHROMA_SEND_INTERVAL_MS );+ continue;+ }+ for( Int device = 0; device < CHROMA_DEVICE_COUNT; ++device )+ {+ _snprintf( devicePath[ device ], sizeof( devicePath[ device ] ), "%s/%s",+ sessionRoot, CHROMA_DEVICES[ device ].endpoint );+ devicePath[ device ][ sizeof( devicePath[ device ] ) - 1 ] = 0;+ }+ memset( sent, 0, sizeof( sent ) );+ lastSendMs = 0;+ }+EnterCriticalSection( &s_cellLock );memcpy( cells, s_pendingCells, sizeof( cells ) );LeaveCriticalSection( &s_cellLock );- const DWORD nowMs = timeGetTime();const Bool keepalive = lastSendMs == 0 || nowMs - lastSendMs >= CHROMA_KEEPALIVE_MS;Bool sentAnything = FALSE;for( Int device = 0; device < CHROMA_DEVICE_COUNT; ++device )@@ -1011,10 +1069,8 @@ static DWORD WINAPI chromaWorkerMain( LPVOID )Sleep( CHROMA_SEND_INTERVAL_MS );}- // Without this the hardware holds the last frame sent until the session times- // out, so the board stays lit for ten seconds after the game is gone.- chromaRequest( connection, "DELETE", sessionRoot, "", NULL, 0 );- InternetCloseHandle( connection );+ if( connection != NULL )+ chromaDisconnect( connection, sessionRoot );InternetCloseHandle( internet );return 0;}@@ -1316,7 +1372,9 @@ static const ChromaKeyRun CHROMA_KEY_RUNS[] ={ MK_ENTER, 1, 3, 14 },{ MK_KP4, 3, 3, 18 }, // 4, 5, 6- { MK_Z, 10, 4, 2 }, // Z to M, comma, period, slash+ // Z sits one column further right than A: column two of this row is the extra+ // key an ISO board has between left shift and Z (RZKEY_Z is 0x0403).+ { MK_Z, 10, 4, 3 }, // Z to M, comma, period, slash{ MK_UP, 1, 4, 16 },{ MK_KP1, 3, 4, 18 }, // 1, 2, 3@@ -1324,7 +1382,7 @@ static const ChromaKeyRun CHROMA_KEY_RUNS[] ={ MK_LEFT, 1, 5, 15 },{ MK_DOWN, 1, 5, 16 },{ MK_RIGHT, 1, 5, 17 },- { MK_KP0, 1, 5, 18 },+ { MK_KP0, 1, 5, 19 }, // RZKEY_NUMPAD0 is 0x0513};static const Int CHROMA_KEY_RUN_COUNT = sizeof( CHROMA_KEY_RUNS ) / sizeof( CHROMA_KEY_RUNS[ 0 ] );@@ -1737,7 +1795,7 @@ static void chromaFillAlarm( Int *cells, Real alarm )}//------------------------------------------------------------------------------static void chromaFillCells( Int *cells )+static void chromaFillCells( Int *cells, Bool inMatch ){Real red = 0.5f, green = 0.5f, blue = 0.5f;Player *localPlayer = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;@@ -1751,9 +1809,6 @@ static void chromaFillCells( Int *cells )}const Int factionColor = chromaColor( red, green, blue );- // The shell map is a running game as far as GameLogic is concerned, so the- // match test has to exclude it or the main menu lights up like a battle.- const Bool inMatch = TheGameLogic && TheGameLogic->isInGame() && !TheGameLogic->isInShellGame();const UnsignedInt frame = TheGameLogic ? TheGameLogic->getFrame() : 0;Real alarm = 0.0f;@@ -1865,13 +1920,16 @@ void updateChromaKeyboard( void )s_workerRunning = TRUE;}+ // The shell map is a running game as far as GameLogic is concerned, so the+ // match test has to exclude it or the main menu lights up like a battle.+ const Bool inMatch = TheGameLogic != NULL && TheGameLogic->isInGame() && !TheGameLogic->isInShellGame();+ // The option applies live: off, or out of a match, and the worker closes the+ // session and the board goes back to Synapse.+ const Bool wanted = inMatch && TheGlobalData != NULL && TheGlobalData->m_chromaLighting;+ InterlockedExchange( &s_sessionWanted, wanted ? 1 : 0 );+Int cells[ CHROMA_CELLS ];- // The option applies live, so turning it off mid-match has to hand the- // hardware back dark rather than freeze it on the last frame.- if( TheGlobalData != NULL && !TheGlobalData->m_chromaLighting )- memset( cells, 0, sizeof( cells ) );- else- chromaFillCells( cells );+ chromaFillCells( cells, inMatch );EnterCriticalSection( &s_cellLock );memcpy( s_pendingCells, cells, sizeof( s_pendingCells ) );diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex b10154a70..244fe5400 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -13317,8 +13317,11 @@ TEST(chroma_keys_land_on_the_razer_grid)CHECK_EQ(chromaCellForKey('p'), 2 * 22 + 11);CHECK_EQ(chromaCellForKey('a'), 3 * 22 + 2);CHECK_EQ(chromaCellForKey('l'), 3 * 22 + 10);- CHECK_EQ(chromaCellForKey('z'), 4 * 22 + 2);- CHECK_EQ(chromaCellForKey('m'), 4 * 22 + 8);+ // Z's row starts a column later: column two is the ISO key between left shift and Z, which+ // RZKEY_Z = 0x0403 says. At column two every key of the command bar's second row lit the lamp+ // one to its left, and Z's lit a key most boards do not have.+ CHECK_EQ(chromaCellForKey('z'), 4 * 22 + 3);+ CHECK_EQ(chromaCellForKey('m'), 4 * 22 + 9);// Upper case never reaches here: HotKeyManager lowers every key it stores.CHECK_EQ(chromaCellForKey('Q'), -1);CHECK_EQ(chromaCellForKey(' '), -1);@@ -13399,6 +13402,7 @@ TEST(chroma_key_maps_agree_on_every_letter_and_digit)CHECK_NE(chromaCellForMappableKey(MK_KP1), chromaCellForMappableKey(MK_1));CHECK_EQ(chromaCellForMappableKey(MK_KP7), 2 * 22 + 18);CHECK_EQ(chromaCellForMappableKey(MK_KP1), 4 * 22 + 18);+ CHECK_EQ(chromaCellForMappableKey(MK_KP0), 5 * 22 + 19); // RZKEY_NUMPAD0 = 0x0513// The function row, which is where the generals powers landCHECK_EQ(chromaCellForMappableKey(MK_F1), 3);@@ -13410,7 +13414,8 @@ TEST(chroma_key_maps_agree_on_every_letter_and_digit)CHECK_EQ(chromaCellForMappableKey(MK_MINUS), 1 * 22 + 12);CHECK_EQ(chromaCellForMappableKey(MK_LBRACKET), 2 * 22 + 12);CHECK_EQ(chromaCellForMappableKey(MK_SEMICOLON), 3 * 22 + 11);- CHECK_EQ(chromaCellForMappableKey(MK_COMMA), 4 * 22 + 9);+ CHECK_EQ(chromaCellForMappableKey(MK_COMMA), 4 * 22 + 10);+ CHECK_EQ(chromaCellForMappableKey(MK_SLASH), 4 * 22 + 12);CHECK_EQ(chromaCellForMappableKey(MK_NONE), -1);diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.pyindex e0ddbb2d6..9c4e52514 100644--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py@@ -164,6 +164,7 @@ NEW_CONTROLS = [(LABEL, "LabelInputScheme", "GUI:InputScheme"),(COMBO, "ComboBoxInputScheme", None),(CHECK, "CheckWasdCamera", "GUI:WasdCamera"),+ (CHECK, "CheckChromaLighting", "GUI:ChromaLighting"),]# A slider on its own says nothing about where it stands, so each one has a readout beside it that@@ -266,7 +267,8 @@ GROUP_LAYOUT = [("check", "CheckDoubleClickAttackMove")]),("PageControls", 2, "GUI:OptionsGroupInput", [setting("LabelInputScheme", "ComboBoxInputScheme"),- ("check", "CheckWasdCamera")]),+ ("check", "CheckWasdCamera"),+ ("check", "CheckChromaLighting")]),("PageGameplay", 0, "GUI:OptionsGroupBattlefield", [setting("LabelHealthBars", "ComboBoxHealthBars"),