osu-orz 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. osu_orz-0.1.0/.github/scripts/select-release.py +60 -0
  2. osu_orz-0.1.0/.github/workflows/python-wheels.yml +142 -0
  3. osu_orz-0.1.0/.gitignore +6 -0
  4. osu_orz-0.1.0/.gitmodules +3 -0
  5. osu_orz-0.1.0/CMakeLists.txt +24 -0
  6. osu_orz-0.1.0/LICENSE +21 -0
  7. osu_orz-0.1.0/PKG-INFO +102 -0
  8. osu_orz-0.1.0/README.md +82 -0
  9. osu_orz-0.1.0/extern/osu_replay_zip/.gitattributes +63 -0
  10. osu_orz-0.1.0/extern/osu_replay_zip/.gitignore +366 -0
  11. osu_orz-0.1.0/extern/osu_replay_zip/LICENSE +21 -0
  12. osu_orz-0.1.0/extern/osu_replay_zip/Lib/7zTypes.h +600 -0
  13. osu_orz-0.1.0/extern/osu_replay_zip/Lib/Compiler.h +287 -0
  14. osu_orz-0.1.0/extern/osu_replay_zip/Lib/LzmaDec.c +1367 -0
  15. osu_orz-0.1.0/extern/osu_replay_zip/Lib/LzmaDec.h +237 -0
  16. osu_orz-0.1.0/extern/osu_replay_zip/Lib/Precomp.h +127 -0
  17. osu_orz-0.1.0/extern/osu_replay_zip/README.md +37 -0
  18. osu_orz-0.1.0/extern/osu_replay_zip/SPEC_OUTLINE.md +633 -0
  19. osu_orz-0.1.0/extern/osu_replay_zip/Source.cpp +162 -0
  20. osu_orz-0.1.0/extern/osu_replay_zip/cm.h +397 -0
  21. osu_orz-0.1.0/extern/osu_replay_zip/device_space.h +1454 -0
  22. osu_orz-0.1.0/extern/osu_replay_zip/frames_prior.h +122448 -0
  23. osu_orz-0.1.0/extern/osu_replay_zip/frames_prior_gen.cpp +1058 -0
  24. osu_orz-0.1.0/extern/osu_replay_zip/graph.png +0 -0
  25. osu_orz-0.1.0/extern/osu_replay_zip/life_prior.h +86 -0
  26. osu_orz-0.1.0/extern/osu_replay_zip/orz_autopilot.h +812 -0
  27. osu_orz-0.1.0/extern/osu_replay_zip/orz_decimal.h +108 -0
  28. osu_orz-0.1.0/extern/osu_replay_zip/orz_device_std.h +2003 -0
  29. osu_orz-0.1.0/extern/osu_replay_zip/orz_dotnet.h +479 -0
  30. osu_orz-0.1.0/extern/osu_replay_zip/orz_encoder_std.h +1424 -0
  31. osu_orz-0.1.0/extern/osu_replay_zip/orz_frames.h +1161 -0
  32. osu_orz-0.1.0/extern/osu_replay_zip/orz_life.h +285 -0
  33. osu_orz-0.1.0/extern/osu_replay_zip/orz_modes.h +601 -0
  34. osu_orz-0.1.0/extern/osu_replay_zip/orz_parts.h +618 -0
  35. osu_orz-0.1.0/extern/osu_replay_zip/orz_read.h +216 -0
  36. osu_orz-0.1.0/extern/osu_replay_zip/orz_shared.h +1007 -0
  37. osu_orz-0.1.0/extern/osu_replay_zip/orz_state.h +92 -0
  38. osu_orz-0.1.0/extern/osu_replay_zip/orz_tables.h +56 -0
  39. osu_orz-0.1.0/extern/osu_replay_zip/orz_text.h +95 -0
  40. osu_orz-0.1.0/extern/osu_replay_zip/orz_time.h +436 -0
  41. osu_orz-0.1.0/extern/osu_replay_zip/orz_types.h +17 -0
  42. osu_orz-0.1.0/extern/osu_replay_zip/orz_write.h +400 -0
  43. osu_orz-0.1.0/extern/osu_replay_zip/osu_lzma.h +1958 -0
  44. osu_orz-0.1.0/extern/osu_replay_zip/osu_replay_zip.sln +31 -0
  45. osu_orz-0.1.0/extern/osu_replay_zip/osu_replay_zip.vcxproj +190 -0
  46. osu_orz-0.1.0/extern/osu_replay_zip/osu_replay_zip.vcxproj.filters +114 -0
  47. osu_orz-0.1.0/extern/osu_replay_zip/rc.h +416 -0
  48. osu_orz-0.1.0/pyproject.toml +41 -0
  49. osu_orz-0.1.0/src/osu_orz/__init__.py +68 -0
  50. osu_orz-0.1.0/src/osu_orz/_core.cpp +147 -0
  51. osu_orz-0.1.0/src/osu_orz/py.typed +0 -0
  52. osu_orz-0.1.0/tests/test_osu_orz.py +200 -0
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+ """Decide whether this run publishes a release: a push to main whose pyproject.toml version has no finished release."""
3
+
4
+ import json
5
+ import os
6
+ import re
7
+ import subprocess
8
+ import tomllib
9
+ from pathlib import Path
10
+
11
+
12
+ ROOT = Path(__file__).parents[2]
13
+
14
+
15
+ def command(*args: str) -> str:
16
+ return subprocess.check_output(args, cwd=ROOT, text=True).strip()
17
+
18
+
19
+ def main() -> None:
20
+ version = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"]["version"]
21
+ if not re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+", version):
22
+ raise SystemExit(f"unsupported release version: {version}")
23
+
24
+ current = tuple(map(int, version.split(".")))
25
+ tag = f"v{version}"
26
+ tags = command("git", "tag", "--list", "v[0-9]*.[0-9]*.[0-9]*").splitlines()
27
+ releases = [
28
+ tuple(map(int, value[1:].split(".")))
29
+ for value in tags
30
+ if re.fullmatch(r"v[0-9]+\.[0-9]+\.[0-9]+", value)
31
+ ]
32
+ latest = max(releases, default=(0, 0, 0))
33
+ tag_exists = tag in tags
34
+ if current < latest or (current == latest and not tag_exists):
35
+ raise SystemExit(f"version {version} is not newer than the latest tag")
36
+
37
+ release = subprocess.run(
38
+ ["gh", "release", "view", tag, "--json", "isDraft"],
39
+ cwd=ROOT,
40
+ text=True,
41
+ capture_output=True,
42
+ )
43
+ release_state = json.loads(release.stdout) if release.returncode == 0 else None
44
+ publish = (
45
+ os.environ["GITHUB_EVENT_NAME"] == "push"
46
+ and os.environ["GITHUB_REF"] == "refs/heads/main"
47
+ and (not tag_exists or release_state is None or release_state["isDraft"])
48
+ )
49
+ if tag_exists and publish:
50
+ tagged_commit = command("git", "rev-list", "-n", "1", tag)
51
+ if tagged_commit != os.environ["GITHUB_SHA"]:
52
+ raise SystemExit(f"unfinished {tag} release belongs to another commit")
53
+
54
+ with Path(os.environ["GITHUB_OUTPUT"]).open("a") as output:
55
+ print(f"publish={str(publish).lower()}", file=output)
56
+ print(f"tag={tag}", file=output)
57
+
58
+
59
+ if __name__ == "__main__":
60
+ main()
@@ -0,0 +1,142 @@
1
+ name: Python wheels
2
+
3
+ # Every push and pull request builds and tests the wheel. A push to main whose pyproject.toml version has no finished
4
+ # release publishes it: the v{version} tag and GitHub release, then PyPI through trusted publishing.
5
+
6
+ on:
7
+ pull_request:
8
+ push:
9
+ branches: [main]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ release-metadata:
17
+ runs-on: ubuntu-24.04
18
+ outputs:
19
+ publish: ${{ steps.release.outputs.publish }}
20
+ tag: ${{ steps.release.outputs.tag }}
21
+ steps:
22
+ - uses: actions/checkout@v6
23
+ with:
24
+ fetch-depth: 0
25
+ persist-credentials: false
26
+ - uses: actions/setup-python@v6
27
+ with:
28
+ python-version: '3.12'
29
+ - name: Validate version and select release
30
+ id: release
31
+ env:
32
+ GH_TOKEN: ${{ github.token }}
33
+ run: python .github/scripts/select-release.py
34
+
35
+ wheels:
36
+ name: Wheel / linux-x86_64
37
+ runs-on: ubuntu-24.04
38
+ steps:
39
+ - uses: actions/checkout@v6
40
+ with:
41
+ submodules: true
42
+ persist-credentials: false
43
+ - uses: pypa/cibuildwheel@v4.2.1
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: osu-orz-wheel-linux-x86_64
47
+ path: wheelhouse/*.whl
48
+
49
+ installed:
50
+ name: Installed / linux-x86_64 / Python ${{ matrix.python }}
51
+ needs: wheels
52
+ runs-on: ubuntu-24.04
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ python: ['3.12', '3.14']
57
+ steps:
58
+ - uses: actions/checkout@v6
59
+ with:
60
+ persist-credentials: false
61
+ - uses: actions/setup-python@v6
62
+ with:
63
+ python-version: ${{ matrix.python }}
64
+ - uses: actions/download-artifact@v4
65
+ with:
66
+ name: osu-orz-wheel-linux-x86_64
67
+ path: wheelhouse
68
+ - run: python -m pip install pytest
69
+ - run: python -m pip install --no-index --find-links wheelhouse osu-orz
70
+ - run: python -m pytest tests
71
+
72
+ source-install:
73
+ name: Source install
74
+ runs-on: ubuntu-24.04
75
+ steps:
76
+ - uses: actions/checkout@v6
77
+ with:
78
+ submodules: true
79
+ persist-credentials: false
80
+ - uses: actions/setup-python@v6
81
+ with:
82
+ python-version: '3.12'
83
+ - run: python -m pip install '.[test]'
84
+ - run: python -m pytest tests
85
+
86
+ sdist:
87
+ name: Source distribution
88
+ if: needs.release-metadata.outputs.publish == 'true'
89
+ needs: release-metadata
90
+ runs-on: ubuntu-24.04
91
+ steps:
92
+ - uses: actions/checkout@v6
93
+ with:
94
+ submodules: true
95
+ persist-credentials: false
96
+ - uses: actions/setup-python@v6
97
+ with:
98
+ python-version: '3.14'
99
+ - run: python -m pip install build
100
+ - run: python -m build --sdist
101
+ - uses: actions/upload-artifact@v4
102
+ with:
103
+ name: osu-orz-sdist
104
+ path: dist/*.tar.gz
105
+
106
+ publish:
107
+ name: Publish release artifacts
108
+ if: needs.release-metadata.outputs.publish == 'true'
109
+ needs: [release-metadata, wheels, installed, source-install, sdist]
110
+ runs-on: ubuntu-24.04
111
+ environment:
112
+ name: pypi
113
+ url: https://pypi.org/p/osu-orz
114
+ permissions:
115
+ contents: write
116
+ id-token: write
117
+ steps:
118
+ - uses: actions/download-artifact@v4
119
+ with:
120
+ pattern: osu-orz-*
121
+ path: dist
122
+ merge-multiple: true
123
+ - name: Create draft release and upload artifacts
124
+ env:
125
+ GH_TOKEN: ${{ github.token }}
126
+ RELEASE_TAG: ${{ needs.release-metadata.outputs.tag }}
127
+ run: |
128
+ if ! gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
129
+ gh release create "$RELEASE_TAG" --draft --generate-notes \
130
+ --target "$GITHUB_SHA" --title "$RELEASE_TAG" \
131
+ --repo "$GITHUB_REPOSITORY"
132
+ fi
133
+ gh release upload "$RELEASE_TAG" dist/* --clobber \
134
+ --repo "$GITHUB_REPOSITORY"
135
+ - uses: pypa/gh-action-pypi-publish@release/v1
136
+ with:
137
+ skip-existing: true
138
+ - name: Publish GitHub release
139
+ env:
140
+ GH_TOKEN: ${{ github.token }}
141
+ RELEASE_TAG: ${{ needs.release-metadata.outputs.tag }}
142
+ run: gh release edit "$RELEASE_TAG" --draft=false --latest --repo "$GITHUB_REPOSITORY"
@@ -0,0 +1,6 @@
1
+ build/
2
+ dist/
3
+ *.egg-info/
4
+ __pycache__/
5
+ .pytest_cache/
6
+ *.so
@@ -0,0 +1,3 @@
1
+ [submodule "extern/osu_replay_zip"]
2
+ path = extern/osu_replay_zip
3
+ url = https://github.com/rumoi/osu_replay_zip.git
@@ -0,0 +1,24 @@
1
+ cmake_minimum_required(VERSION 3.18...3.31)
2
+ project(${SKBUILD_PROJECT_NAME} LANGUAGES C CXX)
3
+
4
+ find_package(Python 3.12 REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})
5
+ find_package(nanobind CONFIG REQUIRED)
6
+
7
+ set(ORZ ${CMAKE_CURRENT_SOURCE_DIR}/extern/osu_replay_zip)
8
+
9
+ # the LZMA SDK decoder the codec reads replay data with
10
+ add_library(orz_lzma STATIC ${ORZ}/Lib/LzmaDec.c)
11
+ target_include_directories(orz_lzma PUBLIC ${ORZ}/Lib)
12
+ set_target_properties(orz_lzma PROPERTIES POSITION_INDEPENDENT_CODE ON)
13
+
14
+ nanobind_add_module(_core STABLE_ABI NB_STATIC src/osu_orz/_core.cpp)
15
+ target_compile_features(_core PRIVATE cxx_std_20)
16
+ target_include_directories(_core PRIVATE ${ORZ})
17
+ target_link_libraries(_core PRIVATE orz_lzma)
18
+
19
+ # files only decode where every build does its float maths exactly as written: no fused multiply-add contraction
20
+ # (which -march=native would allow) and no fast-math. The codec refuses to build with GCC unless told contraction is off
21
+ target_compile_options(_core PRIVATE -ffp-contract=off -fno-fast-math)
22
+ target_compile_definitions(_core PRIVATE ORZ_FP_CONTRACT_OFF)
23
+
24
+ install(TARGETS _core LIBRARY DESTINATION osu_orz)
osu_orz-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cmyui
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
osu_orz-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: osu-orz
3
+ Version: 0.1.0
4
+ Summary: Lossless compression for osu! replays with the ORZ format
5
+ Author: cmyui
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ License-File: extern/osu_replay_zip/LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Programming Language :: C++
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: System :: Archiving :: Compression
14
+ Project-URL: Source, https://github.com/cmyui/osu-orz
15
+ Project-URL: ORZ format, https://github.com/rumoi/osu_replay_zip
16
+ Requires-Python: >=3.12
17
+ Provides-Extra: test
18
+ Requires-Dist: pytest; extra == "test"
19
+ Description-Content-Type: text/markdown
20
+
21
+ # osu-orz
22
+
23
+ Python bindings for [ORZ](https://github.com/rumoi/osu_replay_zip), a lossless compression format for osu! replays.
24
+
25
+ ```python
26
+ import osu_orz
27
+
28
+ orz = osu_orz.compress(osr_bytes) # an .osr file
29
+ assert osu_orz.decompress(orz) == osr_bytes
30
+
31
+ # bare replay data (the LZMA stream osu! stores for a score) has no header, so say what it is
32
+ orz = osu_orz.compress(replay_data, mode=osu_orz.Mode.OSU_RELAX)
33
+ assert osu_orz.decompress(orz) == replay_data
34
+ ```
35
+
36
+ ## Modes
37
+
38
+ `compress` reads an `.osr`'s game mode and Relax from its header. Bare replay data needs `mode` in place of the header,
39
+ and an `.osr` must not be given one, so the two can never disagree.
40
+
41
+ | `Mode` | Replay |
42
+ |---|---|
43
+ | `OSU`, `TAIKO`, `CATCH`, `MANIA` | the game mode, without Relax |
44
+ | `OSU_RELAX`, `TAIKO_RELAX`, `CATCH_RELAX` | the game mode with Relax (osu!mania has none) |
45
+
46
+ The values are the mode numbers ORZ files store. Autopilot replays are `OSU`: the encoder recognises the autopilot
47
+ path from the frames itself. The mode picks the coder and its priors, so a wrong mode only makes the `.orz` bigger: the
48
+ frames come back the same under every mode, and replay data osu! wrote comes back byte for byte.
49
+
50
+ ## What comes back
51
+
52
+ `decompress` rebuilds the input `compress` was given:
53
+
54
+ - the replay frames exactly;
55
+ - the `.osr` fields around them exactly (header, life bar, timestamp, score id);
56
+ - the replay data's LZMA bytes, compressed again the way osu! compresses them. Replay data osu! wrote comes back byte
57
+ for byte. Data written by other software comes back with the same frames, compressed like osu! would.
58
+
59
+ Some replay data is stored as it is, and comes back byte for byte:
60
+
61
+ - data the codec can not code as frames (not LZMA, or text that is not osu!'s frames);
62
+ - data whose coded frames would be no smaller than its LZMA;
63
+ - with `check_round_trip=True`, data whose coded frames do not decode back to it. `compress` then decodes what it wrote
64
+ before returning it, which is slower but keeps a coding bug from turning into a replay that decodes wrong.
65
+
66
+ Errors raise `osu_orz.OrzError` (a `ValueError`): an `.osr` given a `mode`, anything else without one that is not an
67
+ `.osr`, an `.orz` given to `compress`, or an `.orz` that is damaged, cut short or made by a newer format version. A
68
+ `mode` that is not a `Mode` raises `ValueError`. Both functions release the GIL, so threads compress in parallel.
69
+
70
+ `decompress(orz, skip_crc=True)` gives back what a file decodes to even when it fails its CRC check (damaged, or
71
+ written by an incompatible build), to recover what is left of it.
72
+
73
+ ## Format stability
74
+
75
+ ORZ is format version 0 (`osu_orz.FORMAT_VERSION`) and can still change incompatibly between releases. Until the format
76
+ is versioned, decode an `.orz` with the osu-orz version that wrote it.
77
+
78
+ ## Platform
79
+
80
+ Linux on x86-64 (SSE 4.2) with CPython 3.12 or newer. The codec uses x86 CRC instructions, so other architectures do
81
+ not build yet.
82
+
83
+ ## Building from source
84
+
85
+ ```sh
86
+ git clone --recursive https://github.com/cmyui/osu-orz
87
+ pip install './osu-orz[test]'
88
+ pytest osu-orz/tests
89
+ ```
90
+
91
+ This needs a C++20 compiler (GCC 11 or newer, or Clang). The build compiles the codec with `-ffp-contract=off`:
92
+ `.orz` files only decode when every build does its float maths exactly as written, so do not build it with
93
+ `-ffast-math`.
94
+
95
+ ## Releasing
96
+
97
+ Bump `version` in `pyproject.toml` and merge to `main`. CI then builds and tests the wheel, tags `v{version}`, makes a
98
+ GitHub release and publishes to PyPI.
99
+
100
+ ## License
101
+
102
+ MIT. The ORZ codec in `extern/osu_replay_zip` is MIT licensed by rumoi; wheels include both licenses.
@@ -0,0 +1,82 @@
1
+ # osu-orz
2
+
3
+ Python bindings for [ORZ](https://github.com/rumoi/osu_replay_zip), a lossless compression format for osu! replays.
4
+
5
+ ```python
6
+ import osu_orz
7
+
8
+ orz = osu_orz.compress(osr_bytes) # an .osr file
9
+ assert osu_orz.decompress(orz) == osr_bytes
10
+
11
+ # bare replay data (the LZMA stream osu! stores for a score) has no header, so say what it is
12
+ orz = osu_orz.compress(replay_data, mode=osu_orz.Mode.OSU_RELAX)
13
+ assert osu_orz.decompress(orz) == replay_data
14
+ ```
15
+
16
+ ## Modes
17
+
18
+ `compress` reads an `.osr`'s game mode and Relax from its header. Bare replay data needs `mode` in place of the header,
19
+ and an `.osr` must not be given one, so the two can never disagree.
20
+
21
+ | `Mode` | Replay |
22
+ |---|---|
23
+ | `OSU`, `TAIKO`, `CATCH`, `MANIA` | the game mode, without Relax |
24
+ | `OSU_RELAX`, `TAIKO_RELAX`, `CATCH_RELAX` | the game mode with Relax (osu!mania has none) |
25
+
26
+ The values are the mode numbers ORZ files store. Autopilot replays are `OSU`: the encoder recognises the autopilot
27
+ path from the frames itself. The mode picks the coder and its priors, so a wrong mode only makes the `.orz` bigger: the
28
+ frames come back the same under every mode, and replay data osu! wrote comes back byte for byte.
29
+
30
+ ## What comes back
31
+
32
+ `decompress` rebuilds the input `compress` was given:
33
+
34
+ - the replay frames exactly;
35
+ - the `.osr` fields around them exactly (header, life bar, timestamp, score id);
36
+ - the replay data's LZMA bytes, compressed again the way osu! compresses them. Replay data osu! wrote comes back byte
37
+ for byte. Data written by other software comes back with the same frames, compressed like osu! would.
38
+
39
+ Some replay data is stored as it is, and comes back byte for byte:
40
+
41
+ - data the codec can not code as frames (not LZMA, or text that is not osu!'s frames);
42
+ - data whose coded frames would be no smaller than its LZMA;
43
+ - with `check_round_trip=True`, data whose coded frames do not decode back to it. `compress` then decodes what it wrote
44
+ before returning it, which is slower but keeps a coding bug from turning into a replay that decodes wrong.
45
+
46
+ Errors raise `osu_orz.OrzError` (a `ValueError`): an `.osr` given a `mode`, anything else without one that is not an
47
+ `.osr`, an `.orz` given to `compress`, or an `.orz` that is damaged, cut short or made by a newer format version. A
48
+ `mode` that is not a `Mode` raises `ValueError`. Both functions release the GIL, so threads compress in parallel.
49
+
50
+ `decompress(orz, skip_crc=True)` gives back what a file decodes to even when it fails its CRC check (damaged, or
51
+ written by an incompatible build), to recover what is left of it.
52
+
53
+ ## Format stability
54
+
55
+ ORZ is format version 0 (`osu_orz.FORMAT_VERSION`) and can still change incompatibly between releases. Until the format
56
+ is versioned, decode an `.orz` with the osu-orz version that wrote it.
57
+
58
+ ## Platform
59
+
60
+ Linux on x86-64 (SSE 4.2) with CPython 3.12 or newer. The codec uses x86 CRC instructions, so other architectures do
61
+ not build yet.
62
+
63
+ ## Building from source
64
+
65
+ ```sh
66
+ git clone --recursive https://github.com/cmyui/osu-orz
67
+ pip install './osu-orz[test]'
68
+ pytest osu-orz/tests
69
+ ```
70
+
71
+ This needs a C++20 compiler (GCC 11 or newer, or Clang). The build compiles the codec with `-ffp-contract=off`:
72
+ `.orz` files only decode when every build does its float maths exactly as written, so do not build it with
73
+ `-ffast-math`.
74
+
75
+ ## Releasing
76
+
77
+ Bump `version` in `pyproject.toml` and merge to `main`. CI then builds and tests the wheel, tags `v{version}`, makes a
78
+ GitHub release and publishes to PyPI.
79
+
80
+ ## License
81
+
82
+ MIT. The ORZ codec in `extern/osu_replay_zip` is MIT licensed by rumoi; wheels include both licenses.
@@ -0,0 +1,63 @@
1
+ ###############################################################################
2
+ # Set default behavior to automatically normalize line endings.
3
+ ###############################################################################
4
+ * text=auto
5
+
6
+ ###############################################################################
7
+ # Set default behavior for command prompt diff.
8
+ #
9
+ # This is need for earlier builds of msysgit that does not have it on by
10
+ # default for csharp files.
11
+ # Note: This is only used by command line
12
+ ###############################################################################
13
+ #*.cs diff=csharp
14
+
15
+ ###############################################################################
16
+ # Set the merge driver for project and solution files
17
+ #
18
+ # Merging from the command prompt will add diff markers to the files if there
19
+ # are conflicts (Merging from VS is not affected by the settings below, in VS
20
+ # the diff markers are never inserted). Diff markers may cause the following
21
+ # file extensions to fail to load in VS. An alternative would be to treat
22
+ # these files as binary and thus will always conflict and require user
23
+ # intervention with every merge. To do so, just uncomment the entries below
24
+ ###############################################################################
25
+ #*.sln merge=binary
26
+ #*.csproj merge=binary
27
+ #*.vbproj merge=binary
28
+ #*.vcxproj merge=binary
29
+ #*.vcproj merge=binary
30
+ #*.dbproj merge=binary
31
+ #*.fsproj merge=binary
32
+ #*.lsproj merge=binary
33
+ #*.wixproj merge=binary
34
+ #*.modelproj merge=binary
35
+ #*.sqlproj merge=binary
36
+ #*.wwaproj merge=binary
37
+
38
+ ###############################################################################
39
+ # behavior for image files
40
+ #
41
+ # image files are treated as binary by default.
42
+ ###############################################################################
43
+ #*.jpg binary
44
+ #*.png binary
45
+ #*.gif binary
46
+
47
+ ###############################################################################
48
+ # diff behavior for common document formats
49
+ #
50
+ # Convert binary document formats to text before diffing them. This feature
51
+ # is only available from the command line. Turn it on by uncommenting the
52
+ # entries below.
53
+ ###############################################################################
54
+ #*.doc diff=astextplain
55
+ #*.DOC diff=astextplain
56
+ #*.docx diff=astextplain
57
+ #*.DOCX diff=astextplain
58
+ #*.dot diff=astextplain
59
+ #*.DOT diff=astextplain
60
+ #*.pdf diff=astextplain
61
+ #*.PDF diff=astextplain
62
+ #*.rtf diff=astextplain
63
+ #*.RTF diff=astextplain