Updated json chema structure due to changes in the remorte repository.
- Added malformed schema checking and reporting to the workflow and the updater script
This commit is contained in:
@@ -27,13 +27,23 @@ jobs:
|
|||||||
id: run-python-script
|
id: run-python-script
|
||||||
run: |
|
run: |
|
||||||
python ./offsets/update_offsets.py
|
python ./offsets/update_offsets.py
|
||||||
|
echo "exit_code=$?" >> $GITHUB_OUTPUT
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Check Python Script Exit Code
|
- name: Check Python Script Exit Code
|
||||||
if: steps.run-python-script.outcome == 'failure'
|
if: steps.run-python-script.outcome == 'failure'
|
||||||
run: |
|
run: |
|
||||||
|
echo "Python script exited with code: ${{ steps.run-python-script.outputs.exit_code }}"
|
||||||
|
|
||||||
|
if [ "${{ steps.run-python-script.outputs.exit_code }}" -eq 2 ]; then
|
||||||
|
echo "Could not parse offsets json file, most likely due to a schema change, check logs above!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${{ steps.run-python-script.outputs.exit_code }}" -ne 0 ]; then
|
||||||
echo "Repository has no updates"
|
echo "Repository has no updates"
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# - name: Commit and push changes
|
# - name: Commit and push changes
|
||||||
# if: steps.run-python-script.outcome == 'success'
|
# if: steps.run-python-script.outcome == 'success'
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ if offsets_json["build_number"] == int(build_number):
|
|||||||
|
|
||||||
print("Local offsets (dwLocalPlayer/dwViewMatrix) are outdated, pulling the latest offsets.")
|
print("Local offsets (dwLocalPlayer/dwViewMatrix) are outdated, pulling the latest offsets.")
|
||||||
|
|
||||||
|
try:
|
||||||
offsets_json["build_number"] = int(build_number)
|
offsets_json["build_number"] = int(build_number)
|
||||||
|
|
||||||
offsets_json["dwBuildNumber"] = offsets["engine2.dll"]["dwBuildNumber"]
|
offsets_json["dwBuildNumber"] = offsets["engine2.dll"]["dwBuildNumber"]
|
||||||
@@ -81,6 +82,10 @@ offsets_json["dwLocalPlayerController"] = offsets["client.dll"]["dwLocalPlayerCo
|
|||||||
offsets_json["dwEntityList"] = offsets["client.dll"]["dwEntityList"]
|
offsets_json["dwEntityList"] = offsets["client.dll"]["dwEntityList"]
|
||||||
offsets_json["dwViewMatrix"] = offsets["client.dll"]["dwViewMatrix"]
|
offsets_json["dwViewMatrix"] = offsets["client.dll"]["dwViewMatrix"]
|
||||||
offsets_json["dwPlantedC4"] = offsets["client.dll"]["dwPlantedC4"]
|
offsets_json["dwPlantedC4"] = offsets["client.dll"]["dwPlantedC4"]
|
||||||
|
except KeyError as e:
|
||||||
|
print(f"KeyError (#1): {e}")
|
||||||
|
print("The structure of the remote offsets.json has changed. Please check the repository for updates.")
|
||||||
|
exit(2)
|
||||||
|
|
||||||
client = get_raw_file(urls["client_dll"])
|
client = get_raw_file(urls["client_dll"])
|
||||||
|
|
||||||
@@ -88,12 +93,13 @@ if not client:
|
|||||||
print("Could not find the latest client.dll.")
|
print("Could not find the latest client.dll.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
try:
|
||||||
client_json_base = client["client.dll"]["classes"]
|
client_json_base = client["client.dll"]["classes"]
|
||||||
|
|
||||||
offsets_json["m_bIsDefusing"] = client_json_base["C_CSPlayerPawn"]["fields"]["m_bIsDefusing"]
|
offsets_json["m_bIsDefusing"] = client_json_base["C_CSPlayerPawn"]["fields"]["m_bIsDefusing"]
|
||||||
offsets_json["m_ArmorValue"] = client_json_base["C_CSPlayerPawn"]["fields"]["m_ArmorValue"]
|
offsets_json["m_ArmorValue"] = client_json_base["C_CSPlayerPawn"]["fields"]["m_ArmorValue"]
|
||||||
|
offsets_json["m_pClippingWeapon"] = client_json_base["C_CSPlayerPawn"]["fields"]["m_pClippingWeapon"]
|
||||||
|
|
||||||
offsets_json["m_pClippingWeapon"] = client_json_base["C_CSPlayerPawnBase"]["fields"]["m_pClippingWeapon"]
|
|
||||||
offsets_json["m_flFlashOverlayAlpha"] = client_json_base["C_CSPlayerPawnBase"]["fields"]["m_flFlashOverlayAlpha"]
|
offsets_json["m_flFlashOverlayAlpha"] = client_json_base["C_CSPlayerPawnBase"]["fields"]["m_flFlashOverlayAlpha"]
|
||||||
|
|
||||||
offsets_json["m_flC4Blow"] = client_json_base["C_PlantedC4"]["fields"]["m_flC4Blow"]
|
offsets_json["m_flC4Blow"] = client_json_base["C_PlantedC4"]["fields"]["m_flC4Blow"]
|
||||||
@@ -115,6 +121,10 @@ offsets_json["m_pGameSceneNode"] = client_json_base["C_BaseEntity"]["fields"]["m
|
|||||||
offsets_json["m_szName"] = client_json_base["CCSWeaponBaseVData"]["fields"]["m_szName"]
|
offsets_json["m_szName"] = client_json_base["CCSWeaponBaseVData"]["fields"]["m_szName"]
|
||||||
offsets_json["m_vOldOrigin"] = client_json_base["C_BasePlayerPawn"]["fields"]["m_vOldOrigin"]
|
offsets_json["m_vOldOrigin"] = client_json_base["C_BasePlayerPawn"]["fields"]["m_vOldOrigin"]
|
||||||
offsets_json["m_vecAbsOrigin"] = client_json_base["CGameSceneNode"]["fields"]["m_vecAbsOrigin"]
|
offsets_json["m_vecAbsOrigin"] = client_json_base["CGameSceneNode"]["fields"]["m_vecAbsOrigin"]
|
||||||
|
except KeyError as e:
|
||||||
|
print(f"KeyError (#2): {e}")
|
||||||
|
print("The structure of the remote client_dll.json has changed. Please check the repository for updates.")
|
||||||
|
exit(2)
|
||||||
|
|
||||||
with open(dest_path, 'w') as dest_file:
|
with open(dest_path, 'w') as dest_file:
|
||||||
json.dump(offsets_json, dest_file, indent=4)
|
json.dump(offsets_json, dest_file, indent=4)
|
||||||
|
|||||||
Reference in New Issue
Block a user