Skip to content

Configini instead of registry#282

Merged
sven-n merged 7 commits intosven-n:mainfrom
Mosch0512:configini
Feb 4, 2026
Merged

Configini instead of registry#282
sven-n merged 7 commits intosven-n:mainfrom
Mosch0512:configini

Conversation

@Mosch0512
Copy link
Contributor

This pull request significantly refactors how game settings are managed by introducing a dedicated CGameConfig class. This change transitions the application from storing configuration data in the Windows Registry to using a config.ini file, enhancing the maintainability and portability of settings. It also integrates secure handling for sensitive information like login passwords through encryption, and centralizes access to all configurable parameters.

Highlights

  • Configuration Management Refactor: Introduced a new CGameConfig class to centralize and manage all game settings, moving away from disparate configuration methods.
  • Registry Deprecation: Replaced the reliance on the Windows Registry for storing game settings with a config.ini file, improving portability and ease of access.
  • Secure Login Credential Handling: Implemented encrypted storage for login passwords within the config.ini file, utilizing Windows Data Protection API (DPAPI) and hex encoding for enhanced security.
  • Centralized Settings Access: Consolidated various game settings, including window dimensions, display mode, graphics options, audio preferences, login credentials, and server connection details, under the unified CGameConfig system.

….ini`, adding encrypted credential support, logging updates, and replacing registry dependency.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Mosch0512, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly modernizes the application's configuration management. It transitions from using the Windows Registry to a more portable config.ini file, centralizing all game settings within a new CGameConfig class. This refactoring also introduces secure handling for sensitive login credentials using DPAPI encryption, improving both maintainability and security.

Highlights

  • Configuration Management Refactor: Introduced a new CGameConfig class to centralize and manage all game settings, moving away from disparate configuration methods.
  • Registry Deprecation: Replaced the reliance on the Windows Registry for storing game settings with a config.ini file, improving portability and ease of access.
  • Secure Login Credential Handling: Implemented encrypted storage for login passwords within the config.ini file, utilizing Windows Data Protection API (DPAPI) and hex encoding for enhanced security.
  • Centralized Settings Access: Consolidated various game settings, including window dimensions, display mode, graphics options, audio preferences, login credentials, and server connection details, under the unified CGameConfig system.
  • Constant Renaming: Replaced MAX_ID_SIZE with MAX_USERNAME_SIZE across numerous files for clearer semantics and consistency.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/bin/config.ini
    • Added new default settings for window dimensions, graphics options (color depth, render text type), audio preferences (sound/music enabled, volume), login options (remember me, language, encrypted username/password), and connection details (server IP/port).
  • src/source/CSEventMatch.cpp
    • Replaced MAX_ID_SIZE with MAX_USERNAME_SIZE in CMultiLanguage::ConvertFromUtf8 calls.
  • src/source/CSMapServer.cpp
    • Replaced MAX_ID_SIZE with MAX_USERNAME_SIZE in declarations and function calls related to character IDs.
  • src/source/CharMakeWin.cpp
    • Updated InputTextMax[0] to use MAX_USERNAME_SIZE.
  • src/source/DuelMgr.cpp
    • Replaced MAX_ID_SIZE with MAX_USERNAME_SIZE in string copy and comparison functions for duel player IDs.
  • src/source/DuelMgr.h
    • Updated DUEL_PLAYER_INFO and DUEL_CHANNEL_INFO structs to use MAX_USERNAME_SIZE for ID fields.
  • src/source/GMCrywolf1st.cpp
    • Updated HeroName array size and string copy operations to use MAX_USERNAME_SIZE.
  • src/source/GameConfig/GameConfig.cpp
    • Added new file: Implements the GameConfig singleton class for loading and saving application settings from config.ini.
    • Provides methods for reading/writing various data types (int, bool, string) to the INI file.
    • Includes helper functions for converting binary data to hex strings and vice-versa.
    • Integrates Windows Data Protection API (DPAPI) for encrypting and decrypting sensitive credentials (username and password).
    • Manages the path to the config.ini file, defaulting to the executable's directory.
  • src/source/GameConfig/GameConfig.h
    • Added new file: Declares the GameConfig singleton class with public getters and setters for various game settings (window, graphics, audio, login, connection).
    • Defines private helper methods for INI file operations and credential encryption/decryption.
  • src/source/GameConfig/GameConfigConstants.h
    • Added new file: Defines constant strings for INI section names, key names, and default values, promoting code clarity and maintainability.
  • src/source/GameShop/MsgBoxIGSSendGift.cpp
    • Updated input box initialization and text retrieval to use MAX_USERNAME_SIZE.
  • src/source/GameShop/MsgBoxIGSSendGift.h
    • Corrected Korean comments to English.
    • Updated m_szID array size to MAX_USERNAME_SIZE.
  • src/source/GameShop/MsgBoxIGSSendGiftConfirm.h
    • Updated m_szID array size to MAX_USERNAME_SIZE.
  • src/source/Guild/UIGuildInfo.cpp
    • Updated s_szTargetID array size and CMultiLanguage::ConvertFromUtf8 call to use MAX_USERNAME_SIZE.
  • src/source/Guild/UIGuildMaster.cpp
    • Updated memset and InputTextMax[0] to use MAX_USERNAME_SIZE.
  • src/source/LoginWin.cpp
    • Modified CLoginWin::Create() to load 'Remember Me' status and encrypted credentials from GameConfig instead of the registry.
    • Updated input box initialization to use MAX_USERNAME_SIZE instead of MAX_ID_SIZE.
    • Changed RequestLogin() to save credentials using GameConfig::EncryptAndSaveCredentials() and clear them if 'Remember Me' is unchecked, replacing direct registry writes and DPAPI calls.
    • Replaced m_pIDInputBox with m_pUsernameInputBox for clarity.
  • src/source/LoginWin.h
    • Renamed m_pIDInputBox to m_pUsernameInputBox for better semantic meaning.
  • src/source/NewUIChatInputBox.cpp
    • Updated szWhisperID array size and m_pWhsprIDInputBox->GetText call to use MAX_USERNAME_SIZE.
  • src/source/NewUICommonMessageBox.cpp
    • Updated HeroName array size and szYourID array size to use MAX_USERNAME_SIZE.
  • src/source/NewUICryWolf.cpp
    • Updated HeroName array size to use MAX_USERNAME_SIZE.
  • src/source/NewUICursedTempleResult.cpp
    • Updated CMultiLanguage::ConvertFromUtf8 call for character ID to use MAX_USERNAME_SIZE.
  • src/source/NewUICursedTempleResult.h
    • Updated CursedTempleGameResult struct to use MAX_USERNAME_SIZE for s_characterId.
  • src/source/NewUICursedTempleSystem.h
    • Corrected Korean comments to English.
    • Updated m_HolyItemPlayerName array size to MAX_USERNAME_SIZE.
  • src/source/NewUICustomMessageBox.cpp
    • Updated wcsncpy calls for winner/loser IDs to use MAX_USERNAME_SIZE.
  • src/source/NewUIGuardWindow.cpp
    • Updated CMultiLanguage::ConvertFromUtf8 call for guild master name to use MAX_USERNAME_SIZE.
  • src/source/NewUITrade.cpp
    • Updated m_szYourID array initialization and wcsncpy calls to use MAX_USERNAME_SIZE.
  • src/source/NewUITrade.h
    • Corrected Korean comments to English.
    • Updated m_szYourID array size to MAX_USERNAME_SIZE.
  • src/source/Scenes/CharacterScene.cpp
    • Updated wcscpy_s call for character name to use MAX_USERNAME_SIZE.
  • src/source/Scenes/LoginScene.cpp
    • Renamed m_ID to m_Username.
    • Updated wcscpy_s and InputTextMax[0] to use m_Username and MAX_USERNAME_SIZE respectively.
  • src/source/Scenes/SceneCore.cpp
    • Updated LogInID declaration to use MAX_USERNAME_SIZE.
  • src/source/UIControls.cpp
    • Updated wcsncpy and wcsncmp calls for various ID fields (guild list, whisper, chat pal, letter, in-game shop) to use MAX_USERNAME_SIZE.
  • src/source/UIControls.h
    • Updated WHISPER_TEXT, GUILDLIST_TEXT, LETTERLIST_TEXT, and IGS_StorageItem structs to use MAX_USERNAME_SIZE for ID fields.
  • src/source/UIPopup.cpp
    • Updated memset and InputTextMax[0] to use MAX_USERNAME_SIZE.
  • src/source/UIWindows.cpp
    • Updated wcsncmp calls for chat friends, SetTextLimit for mailto input, and wcsncpy for friend list operations to use MAX_USERNAME_SIZE.
    • Updated chat room related functions to use MAX_USERNAME_SIZE for names.
  • src/source/UIWindows.h
    • Updated m_szSaveID array size in CUIQuestionWindow to MAX_USERNAME_SIZE.
  • src/source/WSclient.cpp
    • Updated Password, QuestionID, LogInID, ChatWhisperID declarations to use MAX_USERNAME_SIZE.
    • Replaced MAX_ID_SIZE with MAX_USERNAME_SIZE in numerous CMultiLanguage::ConvertFromUtf8, wcscpy, wcsncmp calls across various network packet handling functions (character list, chat, duel, friend list, guild list, etc.).
  • src/source/WSclient.h
    • Replaced MAX_ID_SIZE with MAX_USERNAME_SIZE in various network packet structs (PRECEIVE_CONFIRM_PASSWORD2, PCHATING, PCREATE_PLAYER, PCREATE_TRANSFORM, PCREATE_SUMMON, PRECEIVE_PARTY_LIST, PRECEIVE_GUILD_LIST, PMSG_ANS_DUEL_INVITE, PMSG_REQ_DUEL_ANSWER, PMSG_ANS_DUEL_EXIT, PMSG_ANS_DUEL_CHANNELLIST, PMSG_ANS_DUEL_JOINCNANNEL, PMSG_DUEL_JOINCNANNEL_BROADCAST, PMSG_DUEL_LEAVECNANNEL_BROADCAST, PMSG_DUEL_OBSERVERLIST_BROADCAST, PMSG_DUEL_RESULT_BROADCAST, PSHOPTITLE_CHANGEINFO, GETPSHOPITEMLIST_HEADERINFO, SOLDITEM_RESULTINFO, FS_FRIEND_LIST_DATA, FS_FRIEND_RESULT, FS_ACCEPT_ADD_FRIEND_RESULT, FS_FRIEND_STATE_CHANGE, FS_LETTER_LIST_DATA, FS_CHAT_CHANGE_STATE, FS_CHAT_USERLIST_DATA, PMSG_MATCH_RESULT, MATCH_RESULT, PMSG_ANS_CASTLESIEGESTATE, PRECEIVE_CROWN_SWITCH_INFO, PMSG_ANS_CRYWOLF_HERO_LIST_INFO, PMSG_CURSED_TEMPLE_USER_ADD_EXP, PMSG_RELICS_GET_USER, PMSG_CASHSHOP_GIFTSTORAGELIST).
  • src/source/Winmain.cpp
    • Integrated GameConfig::GetInstance().Load() at application startup to load all settings from config.ini.
    • Updated server IP and port loading to prioritize command-line arguments, then fall back to GameConfig settings.
    • Removed direct registry access for loading various settings (sound, music, resolution, color depth, remember me, text rendering, window mode, language selection).
    • Updated DestroyWindow() to save the volume level using GameConfig::SetVolumeLevel() and GameConfig::Save(), replacing direct registry writes.
    • Corrected a mouse button assignment in WndProc from MouseRButton = false to MouseMButton = false.
    • Replaced m_ID with m_Username and removed m_EncryptedPassword as global variables, relying on GameConfig.
    • Removed the large switch (m_Resolution) block, as window dimensions are now loaded directly from GameConfig.
  • src/source/Winmain.h
    • Renamed m_ID to m_Username for consistency.
  • src/source/ZzzInterface.cpp
    • Updated InputTextMax array and WhisperRegistID array to use MAX_USERNAME_SIZE.
    • Updated ZeroMemory and wchar_t szId declarations to use MAX_USERNAME_SIZE.
  • src/source/ZzzOpenglUtil.cpp
    • Updated __day_history__ struct and file I/O operations to use MAX_USERNAME_SIZE for ID fields.
  • src/source/_define.h
    • Renamed MAX_ID_SIZE to MAX_USERNAME_SIZE to reflect its usage more accurately.
  • src/source/_struct.h
    • Updated CHARACTER_INFO, GUILD_LIST_t, PARTY_t, CHAT_TEXT_t, MATCH_RESULT_t, and CS_DEVILSQUARE_MATCH_RESULT structs to use MAX_USERNAME_SIZE for ID fields.
Activity
  • Mosch0512 created this pull request to refactor configuration management.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is an excellent and significant refactoring that moves game configuration from the Windows Registry to a config.ini file, managed by a new CGameConfig class. This greatly improves portability and maintainability. The introduction of DPAPI-based encryption for credentials is a solid security enhancement. The codebase-wide replacement of MAX_ID_SIZE with MAX_USERNAME_SIZE improves clarity.

My review includes a few suggestions to further improve robustness and code style in the new CGameConfig implementation, such as using safer string copy functions and simplifying some helper functions. I also noted a minor redundancy and a misleading function name. Overall, this is a high-quality contribution.

@sven-n sven-n merged commit b51fe03 into sven-n:main Feb 4, 2026
1 check passed
@Mosch0512 Mosch0512 deleted the configini branch February 4, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants