feat(core): CheatEngine lua struct generator

This commit is contained in:
gromchek 2026-01-15 01:10:51 +03:00
parent 76a76a28a3
commit bbf19bfb77
9 changed files with 1684 additions and 0 deletions

View file

@ -0,0 +1,51 @@
#!/usr/bin/env bash
declare -a INCLUDE_STACK
process_file() {
local file_path="$1"
if [[ ! -f "$file_path" ]]; then
echo "Error: File '$file_path' not found." >&2
exit 1
fi
for included_file in "${INCLUDE_STACK[@]}"; do
if [[ "$included_file" == "$file_path" ]]; then
echo "Error: Circular dependency detected!" >&2
echo "Include stack: ${INCLUDE_STACK[*]} -> $file_path" >&2
exit 1
fi
done
INCLUDE_STACK+=("$file_path")
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ "$line" =~ ^[[:space:]]*--[[:space:]]*#include[[:space:]]+\"(.*)\"[[:space:]]*$ ]]; then
local target_file="${BASH_REMATCH[1]}"
process_file "$(dirname "$file_path")/$target_file"
else
printf '%s\n' "$line"
fi
done < "$file_path"
unset 'INCLUDE_STACK[-1]'
}
while getopts "i:o:" opt; do
case $opt in
i) INPUT_FILE="$OPTARG" ;;
o) OUTPUT_FILE="$OPTARG" ;;
\?) echo "Invalid option: -$OPTARG" >&2; exit 1 ;;
esac
done
if [[ -z "$INPUT_FILE" || -z "$OUTPUT_FILE" ]]; then
echo "Usage: $0 -i <input_file> -o <output_file>"
exit 1
fi
: > "$OUTPUT_FILE"
echo "Building project: $INPUT_FILE -> $OUTPUT_FILE ..."
process_file "$INPUT_FILE" >> "$OUTPUT_FILE"

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
if [ $# -eq 0 ]
then
echo "Select a version to use"
exit 1
fi
./script/build-ce-loader-script -i $1/cgunit.lua -o $2/Load_CGUnit.lua
./script/build-ce-loader-script -i $1/cgplayer.lua -o $2/Load_CGPlayer.lua