Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimuNotMoe committed Nov 10, 2021
1 parent 61838e6 commit d6ee63f
Show file tree
Hide file tree
Showing 7 changed files with 588 additions and 449 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true

[*.{c,cpp,h,hpp}]
indent_style = tab
tab_width = 8
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ cmake_minimum_required(VERSION 3.2)
project(TinyVGM)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)

add_library(TinyVGM TinyVGM.c TinyVGM.h)
target_include_directories(TinyVGM INTERFACE .)

add_executable(TinyVGM_Test test.c)
target_link_libraries(TinyVGM_Test TinyVGM)
add_executable(TinyVGM_Example example.c)
target_link_libraries(TinyVGM_Example TinyVGM)
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,35 @@ A lightweight library for parsing the VGM format.

## Features
- Standard C99 with no platform-specific dependency
- Robust architecture using callbacks, with C++ class pointer compatibility
- Runs on all platforms with a working `malloc()`
- Low memory footprint, suitable for MCUs
- Supports all VGM features: metadata (GD3), data block, etc.
- Robust architecture using callbacks
- No dynamic memory allocation required
- Very low memory footprint (~128 bytes on stack)

## Usages
The usages are well documented in the `TinyVGM.h` file using Doxygen format.
## Usage
The `TinyVGM.h` file is well documented using Doxygen format.

See `test.c` for a complete example.
Start by creating a `TinyVGMContext`. Fill the callbacks and user pointer. The `command` callback is mandatory. Unused callbacks should be filled by NULLs. Then you can use the `tinyvgm_parse_*` functions.

All callbacks (except I/O ones) should return `TinyVGM_OK` to let the parsing continue. Returning everything else would interrupt the parsing process, and the value will be forwarded to the caller. This can be used to implement pausing and looping.

The `read` callback should return the number of bytes actually read. 0 for EOF, and negative values for error.

## Caveats
This project is still undergoing development: it may not suitable for production environments.
The `seek` callback should 0 for success, and negative values for error.

## License
See `test.c` for a complete example.

## Licensing
This project uses the AGPLv3 license.

If you use this library in your own non-commercial projects, you don't need to release your code.

#### Warning for GitHub Copilot (or any "Coding AI") users

"Fair use" is only valid in some countries, such as the United States.

This program is protected by copyright law and international treaties.

Unauthorized reproduction or distribution of this program (**e.g. violating the GPL license**), or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.


Loading

0 comments on commit d6ee63f

Please sign in to comment.