-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# How to ZLib | ||
|
||
## ZLib thread | ||
From what I see, the Library should create separate thread for ZLib data processing. This thread should be put to sleep by condition variable, when there's no requests (and `sceZlibInflate` should signal this variable ofc). | ||
|
||
## sceZlibInitialize | ||
Creates the ZLib processing thread. Passed buffer should not be used, moreover should set it to `nullptr`. | ||
|
||
## sceZlibFinalize | ||
Terminates ZLib processing thread and destroys every active request in queue. | ||
|
||
## sceZlibInflate | ||
Function `sceZlibInflate` creates decompression request and puts it into queue. The thread should process all the requests and store unpacked data for each request to `dst` pointer set by inflate call. The created request should be stored to `reqId` pointer passed to inflate function. | ||
|
||
## sceZlibWaitForDone | ||
Game should call `sceZlibWaitForDone` to check if there's any ready to use inflated blocks, the library stores `reqId` for finished block and returns `Ok`. However there's a `timeout` parameter, this function should return `Err::Zlib::TIMEDOUT` if every decompression request is pending (or the queue is empty). | ||
|
||
## sceZlibGetResult | ||
This function returns the decompressed data length and decompression status for specified request. Probably it should lock the thread if data is not ready yet. | ||
|
||
|
||
## Notes | ||
* There's a hard `64 KiB` limit for decompressed block size, if the decompressed block exceeds this limit, the `sceZlibGetResult` should return `Err::Zlib::NOSPACE` error code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
#pragma once | ||
#include <stdint.h> | ||
|
||
namespace Err {} // namespace Err | ||
namespace Err { | ||
namespace Zlib { | ||
constexpr int32_t FATAL = -2129526529; | ||
constexpr int32_t ALREADY_INITIALIZED = -2129526733; | ||
constexpr int32_t NOT_INITIALIZED = -2129526734; | ||
constexpr int32_t TIMEDOUT = -2129526745; | ||
constexpr int32_t NOT_SUPPORTED = -2129526747; | ||
constexpr int32_t NOSPACE = -2129526756; | ||
constexpr int32_t INVALID = -2129526762; | ||
constexpr int32_t FAULT = -2129526770; | ||
constexpr int32_t AGAIN = -2129526773; | ||
constexpr int32_t NOT_FOUND = -2129526782; | ||
} // namespace Zlib | ||
} // namespace Err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters