mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-05 00:39:04 +00:00
Add source code for ctrtool
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#include <tc/io/StreamUtil.h>
|
||||
|
||||
int64_t tc::io::StreamUtil::getSeekResult(int64_t offset, tc::io::SeekOrigin origin, int64_t current_position, int64_t stream_length)
|
||||
{
|
||||
int64_t new_pos = 0;
|
||||
switch (origin)
|
||||
{
|
||||
case (SeekOrigin::Begin):
|
||||
new_pos = offset;
|
||||
break;
|
||||
case (SeekOrigin::Current):
|
||||
new_pos = current_position + offset;
|
||||
break;
|
||||
case (SeekOrigin::End):
|
||||
new_pos = stream_length + offset;
|
||||
break;
|
||||
default:
|
||||
throw tc::ArgumentOutOfRangeException("Illegal value for origin.");
|
||||
}
|
||||
|
||||
return new_pos;
|
||||
}
|
||||
Reference in New Issue
Block a user