1
0
mirror of synced 2024-12-18 13:45:54 +01:00
Commit Graph

210 Commits

Author SHA1 Message Date
Viv
9a24b90618 Add new test for checking dummy TJA errors 2023-07-23 10:11:42 -04:00
Viv
907ea43f16
Update README.md 2023-07-23 09:16:11 -04:00
Viv
3ae4bcc310
README.md: Play with <br> 2023-07-23 09:15:41 -04:00
Viv
ee7a3ae3cf
README.md: Remove ? from legend 2023-07-23 09:14:37 -04:00
Viv
b965633a73
README.md: Split tables into two 2023-07-23 09:11:10 -04:00
Viv
54d0ce402b
README.md: Rearrange table and fix command typos 2023-07-23 08:42:55 -04:00
Viv
eaa824cacf
README.md: Fix issues 2023-07-23 08:31:09 -04:00
Viv
2ca5406cdc
README.md: Shorten tagline 2023-07-22 21:05:26 -04:00
Viv
f4d5a52e5c
README.md: Style Note: paragraph 2023-07-22 21:03:18 -04:00
Viv
e1d562f5ef
README.md: Restructure sections, add badges, add command support
Fixes #43.
2023-07-22 20:57:51 -04:00
Viv
5e313a3549
README.md: Fix logo colors 2023-07-22 18:23:57 -04:00
Viv
9c31f41066
README.md: Add newline 2023-07-22 10:44:26 -04:00
Viv
56df81b59b
README.md: Add logo, divider, smaller headers 2023-07-22 10:41:14 -04:00
Viv
60a9e249cd parsers.py: Rename read_fumen function 2023-07-21 23:18:09 -04:00
Viv
9d0d8b9314 parsers.py: Rename parsed_tja and lines 2023-07-21 23:17:05 -04:00
Viv
e756f5c07f parsers.py: Rename parse_course_measures function 2023-07-21 23:15:47 -04:00
Viv
26fbcdff81 parsers.py: Rename get_course_data function 2023-07-21 23:14:24 -04:00
Viv
e318d0a8a3 Fold utils.py into parsers.py and writers.py 2023-07-21 23:13:27 -04:00
Viv
356bb7b036
Update codebase to adhere to flake8 and add linting check (#51) 2023-07-21 22:57:18 -04:00
Viv
e1cd6f385d converters.py: Use branch_points to compute p conditions
This is a much more clear/accurate way to compute the branchInfo values.
2023-07-20 23:03:23 -04:00
Viv
dbf222e460 converters.py: Simplify branching header byte checks 2023-07-20 23:03:14 -04:00
Viv
000125eb10
Ensure that header branch bytes are correctly set for all branching cases (#50)
Some backstory:

- In [#45](https://github.com/vivaria/tja2fumen/pull/45), I reworked the
header parsing code to make sure every header value was correctly
identified.
- In [#46](https://github.com/vivaria/tja2fumen/pull/46), I changed how
the "branch point" header bytes were set by checking if a song contained
only drumroll branching conditions. This fixed drumroll-only songs like
BATTLE NO. 1, Shoutoku Taiko, etc.

However, I missed a corner case in #46 -- songs with `#BRANCHSTART
p,0,0` should still be considered "drumroll only". As well, I neglected
to consider the "percentage only" songs. So, I fixed the header bytes
there, too.

Then, to confirm that my changes do in fact produce correct headers, I
enabled the check for `branch_points` for (most) of the songs in the
test suite. The tests pass. :)
2023-07-20 21:58:58 -04:00
Viv
5ce313ca83 Rename advanced -> professional 2023-07-19 23:45:59 -04:00
Viv
1bf83d09dc
Simplify how HP values are stored and parsed (#49)
- Merge 42 LUTs into 1 LUT
- Greatly simplify HP methods

Fixes #48.
2023-07-19 23:43:56 -04:00
Viv
3704d0a627 converters.py: Fix bug with HP byte 2023-07-19 22:59:07 -04:00
Viv
1777100d3d test_conversion: Add HP bytes to test suite
Will need to comment out the remaining header bytes and test them for the existing songs.
2023-07-19 22:59:07 -04:00
Viv
48718b2303
Fix variable case (camelCase -> snake_case + CONST_CASE) (#47)
Wouldn't have been possible without
https://gist.github.com/Mizzlr/eec29687704aa81bf61dfccda36ddb8c.

Fixes #8 .
2023-07-19 21:50:09 -04:00
Viv
e5fcc4d497 parsers.py: Stop throwing NotImplementedError for unsupported commands 2023-07-19 17:54:11 -04:00
Viv
604ae94742 parsers.py: Condense readFumen 2023-07-19 17:52:41 -04:00
Viv
45a1774221 parsers.py: Remove unnecessary seek 2023-07-19 17:49:09 -04:00
Viv
077d07d023 writers.py: Condense writeFumen 2023-07-19 17:47:40 -04:00
Viv
e38fc4d666 writers.py: Remove unnecessary preallocation step 2023-07-19 17:44:05 -04:00
Viv
9ce1d76ca3
Fix branching behavior for #BRANCHSTART r songs (#46)
This PR updates the behavior for songs with drumroll branching
conditions (`#BRANCHSTART r`)

The changes include:

- Correctly setting the `branchInfo` bytes for branching conditions that
occur _after_ the first condition.
- Correctly setting the `branch_points` bytes in the header when there
are only drumroll conditions.
- Correctly setting the `branch_ratio` bytes in the header when total
notes differ between branches.
- Correctly handling #SECTION commands for a number of different corner
cases:
    1. #SECTION occurs on its own without a #BRANCHSTART
    2. #BRANCHSTART occurs with a #SECTION command
3. #BRANCHSTART occurs without a #SECTION command (and is first branch
condition)
4. #BRANCHSTART occurs without a #SECTION command (and is NOT first
branch condition)


Note: I've added `shoto9` to the test suite, but the TJA file is
structured in a way that the number of measures doesn't match the number
of fumen measures. The TJA needs to be reworked, but that's okay,
because its purpose was just to check that the branching bytes were
correct.

Fixes #40.
2023-07-19 16:47:08 -04:00
Viv
2a6d1c3df5
Overhaul header metadata code with new FumenHeader Python class (plus use ints, not bytes) (#45)
Previously, I had to reverse engineer many of the bytes in a valid fumen
header. This meant that I was often working with literal byte values, as
well as guessing at what things meant, calling them "padding" or
"unknown".

However, thanks to #44, I now have a TON of knowledge about the correct
purpose of each byte in the header. This lets me properly document each
value's purpose, and it also lets me parse 4-byte groups as ints, rather
than dealing with individual raw bytes.

In summary, the changes in this PR are:

- Create a new `FumenHeader` class with individual (correctly-named!)
attributes for each 4-byte integer.
- Parse and write the fumen header as one big 520-byte chunk, instead of
handling the header in smaller increments.
- Remove a bunch of dead lines of code that were hardcoding specific
byte values, and replace them with proper integer values.
- Vastly simplify the test for valid headers by removing checks against
individual bytes..

Necessary for #40.
Fixes #44.
2023-07-19 14:36:58 -04:00
Viv
ecfed22b38 Update README.md 2023-07-19 14:10:32 -04:00
Viv
b5abb8d4b9 parsers.py: Add support for multi-value SCOREINIT/SCOREDIFF
Fixes #34.
2023-07-15 12:02:50 -04:00
Viv
fbe2fe21cc
Fix crash for #SECTION commands that occur before the first #BRANCHSTART (#36)
This PR adds `genpe.tja` to the test suite, a song that currently fails
due to how `tja2fumen` handles `#SECTION` commands.

We fix the problems with branching commands in
8ad2102f0a. (Making sure that any #SECTION
commands that occur before the first #BRANCHSTART are properly handled.)

This PR also contains a few refactoring commits to improve the clarity
of how the branching logic works, to make further debugging of branching
songs easier.

Fixes #33.
2023-07-15 11:58:33 -04:00
Viv
ee265327de
README.md: Expand "Goals" section 2023-07-11 21:33:30 -04:00
Viv
cd755bd646
Replace all {song, branch, measure, note} dictionaries with classes (#32)
This refactor will hopefully pave the way for further refactors that
will make this code easier to understand and work with.

Fixes #9.
2023-07-11 21:30:55 -04:00
Viv
bd27e9dade
Add new LUTs to cover the remaining soul gauge bytes (12/13, 16/17) (#31)
Fixes #14.
2023-07-11 08:07:30 -04:00
Viv
c108475026 __init__.py: Refactor repeatable steps into function 2023-07-10 17:48:18 -04:00
Viv
86c8909b0f __init__.py: Remove unnecessary return variables 2023-07-10 00:40:22 -04:00
Viv
6baf2e55f2 Add gimcho.tja to test suite 2023-07-10 00:08:59 -04:00
Viv
d5ff97b72f test_and_publish_release.yml: Try making executable smaller 2023-07-10 00:01:29 -04:00
Viv
2dec26d2bf
Add support for #BRANCHSTART p,999,999 and #SECTION commands via imcanz.tja (#30)
This PR adds a new chart to the test suite (`imcanz.tja`) that uses
`p,0,0`, `p,999,999` _and_ `#SECTION` commands:

- `p,0,0`: Forces the chart into the Master branch (since it's
impossible to fail a 0% accuracy requirement)
- `p,999,999`: Forces the chart into the Normal branch (since it's
impossible to pass a 999% accuracy requirement)
- `#SECTION`: Resets accuracy values for notes and drumrolls on the next
measure. (In practice, this just means that the branch condition is
repeated on the next measure, at least according to the official fumen I
have.)

Note: Only the Oni and Hard difficulties have actually been added to the
test suite. The Normal and Easy charts were too broken to easily match
the official fumens. They will need a lot of work to fix charting
errors, so I'm leaving them commented out for now.

Fixes #27.
2023-07-09 19:56:57 -04:00
Viv
3ebbb678f4 parsers.py: Remove dead code from readFumen function 2023-07-09 17:17:46 -04:00
Viv
bc21f5a31d converters.py: Improve comments in convertTJAToFumen function 2023-07-09 16:19:20 -04:00
Viv
fac814f6de converters.py: Reorder the branchStart step 2023-07-09 15:51:04 -04:00
Viv
7d9ab6f7b2 converters.py: Reorganize the metadata-adjustment steps 2023-07-09 15:51:04 -04:00
Viv
57edc7aecf Simplify how #BPMCHANGEs adjust the fumenOffset
Before:

- If there was a #BPMCHANGE, tana's adjustment would be applied to _the current measure's duration_. This would result in very strange looking, impossible durations (e.g. negative)
- Additionally, this method required us to look ahead to the _next_ measure to determine the adjustment.
- Finally, it required us to keep track of two different durations: measureDurationBase (unadjusted) and measureDuration (adjusted)

After:

- Instead, we now leave the measureDuration as purely as "unadjusted".
- Then, we apply the "BPMCHANGE adjustment" _only_ when computing the fumenOffset start of the next measure.
- This requires us to keep track of both the start *and* end fumenOffset (where end = start + duration)
- However, this greatly simplifies and clarifies the code, since we:
  - No longer need to "look ahead" to the next measure to compute the offset adjustment.
  - No longer need to keep track of two different measureDurations (adjusted/unadjusted)
  - Only need to work with a single pair of measures at a time (measureFumen, measureFumenPrev)
  - The measure duration (and fumenOffsetEnd) times are now more comprehensible, since any negative offsets are only applied to the fumenOffsetStart value of the next measure.

After:
2023-07-09 15:51:04 -04:00