Skip to content

Commit

Permalink
Merge branch 'master' into Add-ccleaner-missing-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
learn-more authored Aug 22, 2024
2 parents 10658b7 + 11f6eeb commit 4e9732d
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 26 deletions.
46 changes: 38 additions & 8 deletions .github/validate-rapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
PROJECT: ReactOS rapps-db validator
LICENSE: MIT (https://spdx.org/licenses/MIT)
PURPOSE: Validate all rapps-db files
COPYRIGHT: Copyright 2020-2023 Mark Jansen <[email protected]>
COPYRIGHT: Copyright 2020-2024 Mark Jansen <[email protected]>
'''
import os
from pathlib import Path
import sys
from enum import Enum, unique
import struct;


# TODO: make this even nicer by using https://github.com/pytorch/add-annotations-github-action

REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
REPO_ROOT = Path(__file__).parents[1]

REQUIRED_SECTION_KEYS = [
b'Name',
Expand Down Expand Up @@ -95,6 +97,10 @@ def add(self, line, column, problem):
idx = column - 1 + len("b'") # Offset the b' prefix
print(' ' * idx + '^')

def add_file(self, file, problem):
self._problems += 1
print('{file}: {problem}'.format(file=file, problem=problem))

def problems(self):
return self._problems > 0

Expand Down Expand Up @@ -227,11 +233,11 @@ def text(self):
class RappsFile:
def __init__(self, fullname):
self.path = fullname
self.filename = os.path.basename(fullname)
self.filename = fullname.name
self._sections = []

def parse(self, reporter):
with open(self.path, 'rb') as f:
with open(str(self.path), 'rb') as f:
lines = [RappsLine(self, idx + 1, line) for idx, line in enumerate(f.readlines())]

# Create sections from all lines, and add keyvalue entries in their own section
Expand Down Expand Up @@ -298,14 +304,38 @@ def verify_unique(reporter, lines, line, name):
else:
lines[name] = line


def validate_repo(dirname):
def validate_single_icon(icon, reporter):
try:
with open(str(icon), 'rb') as f:
header = f.read(4)
# First we validate the header
if header != b'\x00\x00\x01\x00':
reporter.add_file('icons/' + icon.name, 'Bad icon header')
return
# Check that there is at least one icon
num_icons, = struct.unpack('<H', f.read(2))
if num_icons == 0:
reporter.add_file('icons/' + icon.name, 'Empty icon?')
return
# Should we validate / display individual icons?
# See https://en.wikipedia.org/wiki/ICO_(file_format)#Structure_of_image_directory
except Exception as e:
reporter.add_file('icons/' + icon.name, 'Exception while reading icon: ' + str(e))

def validate_icons(ico_dir, reporter):
for icon in ico_dir.glob('*.ico'):
validate_single_icon(icon, reporter)


def validate_repo(check_dir):
reporter = Reporter()

all_files = [RappsFile(filename) for filename in os.listdir(dirname) if filename.endswith('.txt')]
all_files = [RappsFile(file) for file in check_dir.glob('*.txt')]
for entry in all_files:
entry.parse(reporter)

validate_icons(check_dir / 'icons', reporter)

if reporter.problems():
print('Please check https://reactos.org/wiki/RAPPS for details on the file format.')
sys.exit(1)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/validate-rapps.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This workflow will install Python dependencies, lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: rapps-db validation

Expand All @@ -15,11 +15,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
5 changes: 3 additions & 2 deletions agwak.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Description = A platform game similar to Mario Bros or Kirby. We must go through
Category = 4
URLSite = https://www.origamihero.com/ori6/games.php
URLDownload = https://www.origamihero.com/games/kitty3.zip
SHA1 = CBBC5885B635C72A4FC38E46BFC713F0266CE5A9
SizeBytes = 524667
SHA1 = f1b16d9b3b09a0be528b7fc05efe9e03ff725ec9
SizeBytes = 11171050
Installer = Generate
20 changes: 10 additions & 10 deletions cheatengine.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[Section]
Name = Cheat Engine
Version = 6.2
LicenseType = 1
Description = Cheat Engine is an open-source tool for modifying game variables by scanning and altering memory addresses.
Category = 7
URLSite = https://cheatengine.org/
URLDownload = https://web.archive.org/web/20211225142624if_/https://cheatengine.org/download/CheatEngine62.exe
SHA1 = 5042d797d7fa03425d3ad7e333f5435626ca6534
SizeBytes = 780088
[Section]
Name = Cheat Engine
Version = 6.2
LicenseType = 1
Description = Cheat Engine is an open-source tool for modifying game variables by scanning and altering memory addresses.
Category = 7
URLSite = https://cheatengine.org/
URLDownload = https://web.archive.org/web/20211225142624if_/https://cheatengine.org/download/CheatEngine62.exe
SHA1 = 5042d797d7fa03425d3ad7e333f5435626ca6534
SizeBytes = 780088
Binary file modified icons/renpy.ico
Binary file not shown.
Binary file modified icons/sublime_text.ico
Binary file not shown.
Binary file modified icons/winrar.ico
Binary file not shown.

0 comments on commit 4e9732d

Please sign in to comment.