Skip to content

Instantly share code, notes, and snippets.

@htv04
Created July 24, 2023 21:19
Show Gist options
  • Select an option

  • Save htv04/3607ee170d2c58b6a93a5f1d15e9c443 to your computer and use it in GitHub Desktop.

Select an option

Save htv04/3607ee170d2c58b6a93a5f1d15e9c443 to your computer and use it in GitHub Desktop.
KNLDAT Generator for KokonoePlayer-Lite
#!/usr/bin/env python
# KNLDAT Generator for KokonoePlayer-Lite v1.0
# By HTV04
# Usage: knldat.py [output file] [input files...]
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <https://unlicense.org/>
import sys
from pathlib import Path
if __name__ == "__main__":
with open(sys.argv[1], "w") as f:
f.write("// Automatically generated using knldat.py\n\n#pragma once\n\nenum {\n")
for filename in sys.argv[2:]:
f.write("\tKNL_" + Path(filename).stem.upper() + ",\n")
f.write("\tKNL_MAX\n};\n")
@htv04
Copy link
Author

htv04 commented Jul 24, 2023

NOTE: This script creates a C header file with an enum for use with KokonoePlayer-Lite. The enum correlates with the IDs created by knl-vgm-convert, so long as the input given to that tool is the same as the input given to this script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment