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

210 Commits

Author SHA1 Message Date
Viv
6d8bfb97d5 utils.py: Remove now-unused checkMismatchedBytes func
This was initially used to validate the fumen writer to make sure it properly recreated the data from the fumen parser.

Any further byte-comparison will be done in a semantic way through pytest tests.
2023-06-25 13:40:56 -04:00
Viv
69af60e4e3 Improve readability of header processing code
- header -> headerPadding
- headerUnknown -> headerMetadata
- Add more thorough comments about the meaning of various header bytes
2023-06-25 13:40:56 -04:00
Viv
5899593024 Add notes about item byte in fumen files
See also: https://github.com/vivaria/tja2fumen/issues/17
2023-06-25 13:40:56 -04:00
Viv
52827f1abc Add support for #BARLINE commands
Fixes #3.

Necessary to get `mikdp` test to pass.
2023-06-25 13:40:56 -04:00
Viv
2e54975534 Add first tja-fumen pair (mikdp) to test 2023-06-25 13:40:56 -04:00
Viv
f2760d418b .gitignore: Allow tjas to be committed 2023-06-25 13:40:55 -04:00
Viv
c233dda574 converters.py: Fix bug with #GOGOEND parsing
bool('0') = True. We need to add `int()` so that bool(0) = False.
2023-06-25 12:16:27 -04:00
Viv
3b88104578 Add test to compare converted TJAs to fumens 2023-06-25 12:01:58 -04:00
Viv
2a24790d59 Clean up script I/O to make easier to call from tests 2023-06-25 01:00:08 -04:00
Viv
417bfe59eb pyproject.toml: Update for 0.0.1 release. 2023-06-04 15:27:19 -04:00
Viv
1abd86885e README.md: Update for 0.0.1 release. 2023-06-04 15:27:01 -04:00
Viv
654f67d6e2 Add * to .gitignore folders 2023-06-04 13:55:46 -04:00
Viv
58cafeb4f0 Make project pip-installable
Only local dev installs for now. PyPI will come later.
2023-06-04 12:51:07 -04:00
Viv
fed999164a Add LICENSE.txt file 2023-06-04 12:37:36 -04:00
Viv
a36849b4cc .gitignore: Add *.egg-ingo 2023-06-04 12:32:13 -04:00
Viv
2bfa3e8d31 Move main() from main.py into __init__.py 2023-06-04 12:31:42 -04:00
Viv
90f3d7902f main.py: Remove fumen-parsing code and make TJA mandatory
Fumen code was just for debugging purposes, and not necessary for TJA conversion.
2023-06-04 12:25:41 -04:00
Viv
5d50dcfa41 Switch to a src/ layout 2023-06-04 12:25:40 -04:00
Viv
2f95a8505b parsers.py: Handle STYLE to fix Ura conversion
Fixes #15.
2023-06-03 22:45:24 -04:00
Viv
41d18cf900 converters.py: Fixup comment 2023-06-03 20:40:07 -04:00
Viv
57e4198fe9 converters.py: Predefine variable to silence PyCharm warning 2023-06-03 20:34:58 -04:00
Viv
6d6985917e converters.py: Rename offset variables for clarity 2023-06-03 20:33:41 -04:00
Viv
e053e1ad7a converters.py: Rework the logic for measure offsets
To compute the first measure's offset, I currently subtract the first measure's duration from the TJA's OFFSET value.

However, I realized that you actually have to subtract the *second* measure's duration from the TJA offset value. (For 99% of songs, the first two measures will have the same duration, so that's why the bug slipped by.)

Fixes #4.
2023-06-03 20:32:50 -04:00
Viv
35ee48200f converters.py: Only subtract drumroll pos for single-measure drumroll
Commit 1953ffbc23 fixes one issue but introduced another:

 - Subtracting the drumrolls original position only makes sense if the drumroll starts and ends in the same measure.
 - If the drumroll spans multiple measures, though, then the original position is irrelevant, since we want to add the duration from the start of the next measure (i.e. pos=0).

 So, this commit makes sure to only subtract the position if the drumroll isn't a multi-measure drumroll.

 ((NB: This could probably be handled without using a new 'multimeasure' key, but I'm going to wait until the class refactor to tackle this.))

 Fixes #16.
2023-06-03 14:57:11 -04:00
Viv
1953ffbc23 converters.py: Fix drumroll duration bug
The duration calculation wasn't taking into account the starting position of the drumroll, so the drumrolls ended up with a duration that was way too long.

Fixes #1.
2023-06-03 13:28:20 -04:00
Viv
84056aef27 README.md: Stop using README as issue tracker
I will move the issues to GitHub.
2023-06-03 11:07:27 -04:00
Viv
4bf2072279 main.py: Don't append course ID if tja has only 1 course
This replicates the behavior of the original tja2bin.exe
2023-06-03 11:04:57 -04:00
Viv
77aa9598a0 main.py: Use more reliable method of fetching filename
The old method failed for files with no file extension.
2023-06-03 11:04:12 -04:00
Viv
b2353df58b Add .gitignore file 2023-06-03 10:03:32 -04:00
Viv
e3cd17bf0e main.py: Add basic argparse interface 2023-06-03 09:47:59 -04:00
Viv
5f8b0c4dd5 main.py: Use course ID (m) instead of name (Oni) 2023-06-03 09:47:46 -04:00
Viv
f5aa185ec2 constants.py: Add support for 0-4 course strings 2023-06-03 09:45:53 -04:00
Viv
ffc62c73a9 constants.py: Add missing header constants (SONGVOL, SEVOL) 2023-06-03 09:45:15 -04:00
Viv
394b7badc9 main.py: Refactor main() to support external scripts
- Don't manually convert difficulties by hardcoding names
- Don't write the TJA in `main()`; let the caller decide.
2023-06-02 17:44:00 -04:00
Viv
a510696efc parsers.py: Add support for SHIFT-JIS .tjas
Roppon was formatted as SHIFTJIS, so this was necessary.
2023-06-02 17:44:00 -04:00
Viv
3e2e29baa1 parsers.py: Add NotImplementError else cases
I felt too lazy to explicitly specify each and every unsupported command.
2023-06-02 17:44:00 -04:00
Viv
f5df104e56 parsers.py: Handle incorrectly specified balloon metadata
Carmen Prelude's .tja had "30,10," which would be parsed as ['30', '10', '']. We don't want that last value, so we exclude empty values.
2023-06-02 17:44:00 -04:00
Viv
8b3a56ef0d parsers.py: Fix bug with non-empty whitespace lines
As far as a TJA file goes, ' ' == ''. Both should be discarded.
2023-06-02 17:44:00 -04:00
Viv
d671939c41 Use explicit importing over relative importing
Helps when the package is used by a different script
2023-06-02 17:44:00 -04:00
Viv
ae9cde3a20 Rename tja2fumen.py to main.py 2023-06-02 17:44:00 -04:00
Viv
226060e6b6 constants.py: Add mapping between course names and letter IDs 2023-06-02 17:43:59 -04:00
Viv
f4e8a70f01 constants.py: Add missing header commands 2023-06-02 17:43:59 -04:00
Viv
4d4dacaeab fixup command constants 2023-06-02 17:43:59 -04:00
Viv
a66498a6db Update README.md 2023-06-02 17:43:59 -04:00
Viv
383c2c6fd0 Update README.md 2023-06-02 17:43:59 -04:00
Viv
7c5cd18ac1 Update README.md 2023-06-02 17:43:59 -04:00
Viv
e856f302b7 Update README.md 2023-06-02 17:43:59 -04:00
Viv
5adcdd47d0 Update README.md 2023-06-02 17:43:59 -04:00
Viv
b4ab35a09a Create README.md 2023-06-02 17:43:59 -04:00
Viv
1f3bf163b9 Attempt to handle remaining header bytes 2023-06-02 17:43:59 -04:00