Skip to content

Conversation

@Mosch0512
Copy link
Owner

No description provided.

@Mosch0512 Mosch0512 changed the base branch from main to cpp20 January 26, 2026 23:08
@gemini-code-assist
Copy link

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 focuses on modernizing the codebase by adopting C++20 features and significantly refactoring the data handling architecture. It introduces a generic, metadata-driven system for saving, loading, and tracking changes in game data, replacing older, less flexible implementations. Additionally, it improves code quality through widespread const-correctness enhancements and updates UI constant definitions for better type safety and precision.

Highlights

  • C++20 Adoption and Modernization: The project now explicitly targets C++20, enabling the use of modern language features. This includes replacing a custom span.hpp implementation with the standard std::span from the C++20 library, and updating CMake configurations to enforce C++20 for core targets.
  • Generic Data Handling Refactoring: The data saving and loading mechanisms have been significantly refactored into a generic, templated system. This introduces CommonDataSaver with a flexible SaveConfig struct, allowing for unified handling of various data types (like items and skills) with configurable backup, conversion, encryption, checksum, and change tracking capabilities.
  • Metadata-Driven Field Comparison: A new FieldMetadata system has been implemented, replacing error-prone X-macros with clear, constexpr arrays of FieldInfo structs. This provides a robust and maintainable way to define and compare fields within data structures, improving change logging accuracy and code readability.
  • Enhanced Const-Correctness: Numerous function parameters and variable declarations across the codebase have been updated to use const where appropriate. This improves code safety, clarity, and allows the compiler to catch potential accidental modifications of data.
  • UI Constant Modernization: Many UI-related enum constants defining dimensions and sizes have been converted to static constexpr float or static constexpr int. This improves type safety, allows for floating-point precision where needed, and aligns with modern C++ practices.
  • File Renaming and Structure: Several data handling files have been renamed for better clarity and consistency (e.g., ItemDataFileIO.cpp to DataFileIO.cpp, ItemDataExporter.h to ItemDataExportAsCSV.h). The translation system's file structure documentation has also been updated.

🧠 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.

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.

@Mosch0512 Mosch0512 changed the base branch from cpp20 to main January 26, 2026 23:09
@Mosch0512 Mosch0512 closed this Jan 26, 2026
Copy link

@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 introduces a significant refactoring of the data handling and saving mechanisms, moving towards a more generic and maintainable architecture. Key improvements include the replacement of X-macros with a metadata-driven field comparison system, the introduction of a CommonDataSaver for generalized data persistence, and a unified DataFileIO for file operations. These changes greatly enhance code readability, reduce duplication, and provide a flexible framework for managing different data types (items, skills) with support for legacy formats and change tracking. The documentation for the translation system has also been updated to reflect the new file structure.

{
DWORD calculatedChecksum = GenerateCheckSum2(buffer, bufferSize, 0xE2F1);
int bufferSize = config.itemSize * config.itemCount;
DWORD calculatedChecksum = GenerateCheckSum2(const_cast<BYTE*>(buffer), bufferSize, config.checksumKey);

Choose a reason for hiding this comment

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

high

The VerifyChecksum function passes const_cast<BYTE*>(buffer) to GenerateCheckSum2. This suggests that GenerateCheckSum2 might modify the buffer, which is highly unusual for a checksum calculation function. If GenerateCheckSum2 does not modify the buffer, its first parameter should be const BYTE* to enforce const-correctness. If it does modify the buffer, this is a significant side-effect that should be documented and potentially re-evaluated, as checksum functions are typically read-only operations.

memset(&fileStruct, 0, fileStructSize);

// Convert runtime to file format (cast away const for legacy Copy functions)
config.convertToFile(fileStruct, const_cast<TRuntime&>(config.runtimeData[i]));

Choose a reason for hiding this comment

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

medium

The convertToFile lambda uses const_cast<TRuntime&>(config.runtimeData[i]). This implies that the convertToFile function might modify the TRuntime object, despite config.runtimeData being declared as const TRuntime*. If convertToFile truly needs to modify TRuntime, then config.runtimeData should not be const. If it does not, convertToFile should take const TRuntime& to ensure const-correctness and prevent accidental modifications.

float oldVal = *(const float*)oldPtr;
float newVal = *(const float*)newPtr;
if (oldVal != newVal)
{

Choose a reason for hiding this comment

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

medium

Direct comparison of floating-point numbers (oldVal != newVal) can lead to unexpected results due to precision issues. It's generally recommended to compare floating-point values using an epsilon (a small tolerance) to account for potential inaccuracies.

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