Added TrueType base and HDA driver
This commit is contained in:
parent
aa3f734406
commit
42cc0d9f40
30 changed files with 7120 additions and 35 deletions
46
utils/bin_to_header.py
Normal file
46
utils/bin_to_header.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python3
|
||||
###################################################################################
|
||||
## Module Name: gen_sound_header.py ##
|
||||
## Project: AurixOS ##
|
||||
## ##
|
||||
## Copyright (c) 2024-2025 Jozef Nagy ##
|
||||
## ##
|
||||
## This source is subject to the MIT License. ##
|
||||
## See License.txt in the root of this repository. ##
|
||||
## All other rights reserved. ##
|
||||
## ##
|
||||
## 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 OR COPYRIGHT HOLDERS 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. ##
|
||||
###################################################################################
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
input_file = sys.argv[1]
|
||||
output_file = sys.argv[2]
|
||||
var_name = Path(input_file).stem
|
||||
filesize = os.path.getsize(input_file)
|
||||
raw_input = ""
|
||||
|
||||
with open(input_file, "rb") as f:
|
||||
raw_input = f.read()
|
||||
f.close()
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.write("// THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT!\n\n")
|
||||
f.write("const unsigned int {var}_len = {size};\n".format(var = var_name, size = filesize))
|
||||
f.write("static const unsigned char *{var}_data = {{\n\t".format(var = var_name))
|
||||
for i in range(0, filesize):
|
||||
f.write("{bytes},".format(bytes = format(raw_input[i], '#04x')))
|
||||
if (i % 16) == 15:
|
||||
f.write("\n\t")
|
||||
else:
|
||||
f.write(" ")
|
||||
f.write("};\n")
|
||||
f.close()
|
Loading…
Add table
Add a link
Reference in a new issue