Skip to content

Commit

Permalink
Add API Documentation for WarioSave library
Browse files Browse the repository at this point in the history
  • Loading branch information
savaughn committed Mar 2, 2024
1 parent 94ca965 commit 01c7c40
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
86 changes: 86 additions & 0 deletions docs/headers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# WarioSave Library API Documentation

This document provides a detailed description of the functions provided by the WarioSave library.

## Function Definitions

### `uint8_t ws_get_decimal_byte(const uint8_t byte)`

Converts a byte stored in decimal format in memory to an integer.

- `byte`: The byte to convert.
- Returns: The decimal value of the byte.

### `uint32_t ws_get_decimal_bytes(const uint8_t byte1, const uint8_t byte2, const uint8_t byte3)`

Converts three bytes stored in decimal format in memory to an integer.

- `byte1`: The first byte to convert.
- `byte2`: The second byte to convert.
- `byte3`: The third byte to convert.
- Returns: The decimal value of the three bytes.

### `WS_FileError ws_load_save_to_buffer(WS_WarioGameSave *save, const char *file_path)`

Loads the save data into a WarioGameSave buffer.

- `save`: The WarioGameSave buffer to load the save data into.
- `file_path`: The path to the save file.
- Returns: The WS_FileError error code.

### `WS_Level *ws_get_completion_rate(const WS_WarioSave *save, WS_PlayerSave *player_save)`

Calculates the completion rate of each level and saves the data into a PlayerSave struct.

- `save`: The WarioSave struct.
- `player_save`: The PlayerSave struct.
- Returns: A pointer to the Level struct.

### `void ws_initialize_player_save(const WS_WarioSave *save, WS_PlayerSave *player_save)`

Initializes the PlayerSave struct with the data from the WarioSave struct.

- `save`: The WarioSave struct.
- `player_save`: The PlayerSave struct.

### `void ws_get_level_completion_rates(const WS_WarioSave *save, WS_Level *level_data)`

Calculates the completion rate of each level.

- `save`: The WarioSave struct.
- `level_data`: The array of Level structs.

### `uint8_t ws_get_player_lives(const WS_WarioSave *save)`

Gets the player's life count.

- `save`: The WarioSave struct.
- Returns: The player's life count.

### `uint8_t ws_get_player_hearts(const WS_WarioSave *save)`

Gets the player's heart count.

- `save`: The WarioSave struct.
- Returns: The player's heart count.

### `uint32_t ws_get_player_coins(const WS_WarioSave *save)`

Gets the player's coin count.

- `save`: The WarioSave struct.
- Returns: The player's coin count.

### `bool ws_is_game_completed(const WS_WarioSave *save)`

Checks if the game is completed.

- `save`: The WarioSave struct.
- Returns: A boolean indicating whether the game is completed.

### `WS_Treasure ws_get_treasure_data(const WS_WarioSave *save)`

Gets the save slot treasure data.

- `save`: The WarioSave struct.
- Returns: A Treasure struct.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
WarioSave
===============================================

[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/savaughn/wariosave/blob/master/LICENSE.txt) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/savaughn/wariosave)](https://github.com/savaughn/wariosave/releases) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/savaughn/wariosave/build-macos.yml?branch=master)](https://github.com/savaughn/wariosave/actions) [![GitHub issues](https://img.shields.io/github/issues/savaughn/wariosave)](https://github.com/savaughn/wariosave/issues) [![GitHub](https://img.shields.io/github/license/savaughn/wariosave)](https://github.com/savaughn/wariosave/blob/main/LICENSE) [![GitHub all releases](https://img.shields.io/github/downloads/savaughn/wariosave/total)](https://github.com/savaughn/wariosave/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/savaughn/wariosave/blob/master/LICENSE.txt) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/savaughn/wariosave)](https://github.com/savaughn/wariosave/releases) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/savaughn/wariosave/build-macos.yml?branch=main)](https://github.com/savaughn/wariosave/actions) [![GitHub issues](https://img.shields.io/github/issues/savaughn/wariosave)](https://github.com/savaughn/wariosave/issues) [![GitHub](https://img.shields.io/github/license/savaughn/wariosave)](https://github.com/savaughn/wariosave/blob/main/LICENSE) [![GitHub all releases](https://img.shields.io/github/downloads/savaughn/wariosave/total)](https://github.com/savaughn/wariosave/releases)

The WarioSave library is a C library designed to read the player's save data in Super Mario Land 3: Wario Land. It provides functions to initialize player save data and calculate the completion rate for each level in the game.

Expand All @@ -24,6 +24,7 @@ To use the library, include the header files in your C source files and link aga
```c
#include "wariosave.h"
```
For detailed information on the functions provided by the WarioSave library, see the [API Documentation](docs/headers.md).

## Building the Example

Expand Down

0 comments on commit 01c7c40

Please sign in to comment.