RhythmGame 1.4.3
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions | Variables
support Namespace Reference

Contains various helper classes and functions. More...

Namespaces

namespace  detail
 

Classes

struct  BeatorajaState
 
struct  DXArchiveSegment
 
class  EnableSharedFromBase
 A helper class for creating a shared pointer to self. More...
 
class  Exception
 
class  FrameRateLimiter
 
struct  JavaRandom
 
class  Lr2Random
 
class  PendingReply
 QML-facing handle for one asynchronous result. More...
 
class  PendingReplySource
 Producer-side control for a PendingReply. More...
 
class  QtSink
 
struct  ShuffleResult
 
struct  Timeline
 
struct  TimelineLane
 
struct  TimelinePermutation
 
class  TupleSize
 Used to get the size of a tuple or an aggregate. More...
 

Typedefs

using DXArchive = std::map< std::string, DXArchiveSegment >
 
using Note = charts::BmsNotesData::Note
 
using NoteType = charts::BmsNotesData::NoteType
 
using QtSinkMt = QtSink< std::mutex >
 
using Sha256 = std::string
 
using Md5 = std::string
 

Functions

auto capitalize (std::string_view str) -> std::string
 
template<typename T >
auto compress (const T &data) -> QByteArray
 
template<typename T >
void decompress (QByteArray data, T &out)
 
template<typename T >
T decompress (QByteArray data)
 
QString convertTachiClearType (const int enumIndex)
 
auto createQmlPropertyMap (QObject *parent) -> QQmlPropertyMap *
 
auto normalizeDxaPath (const std::filesystem::path &path) -> std::string
 
DXArchive extractDxaToMem (const std::filesystem::path &path)
 
int extractDxaToFile (const std::filesystem::path &path)
 
auto folderName (QString path) -> QString
 
template<typename T , typename Random >
void fisherYatesShuffle (std::span< T > arr, Random &randomGenerator, bool usePre130)
 
auto getColumsIota (const int size) -> QList< int >
 
auto getNextNote (const std::span< std::vector< charts::BmsNotesData::Note > > arr, std::vector< std::vector< charts::BmsNotesData::Note >::const_iterator > &noteIters) -> std::optional< std::vector< charts::BmsNotesData::Note >::const_iterator >
 
auto pushProposedNote (std::vector< charts::BmsNotesData::Note > &lane, const std::vector< charts::BmsNotesData::Note >::const_iterator &note) -> void
 
auto tryPushingNoteWithDistance (const std::vector< charts::BmsNotesData::Note >::const_iterator &noteIt, const QList< int > &columnsIota, std::vector< std::vector< charts::BmsNotesData::Note > > &newColumns, const std::chrono::nanoseconds preferredNoteDistance) -> bool
 
void pushNoteWithMaxDistance (const std::vector< charts::BmsNotesData::Note >::const_iterator &noteIt, const QList< int > &columnsIota, std::vector< std::vector< charts::BmsNotesData::Note > > &newColumns)
 
template<typename Random >
void shuffleAllNotes (std::span< std::vector< charts::BmsNotesData::Note > > arr, const std::chrono::nanoseconds preferredNoteDistance, Random &randomGenerator, bool usePre130)
 
auto convertColumnsToK7 (QList< int > &columns) -> void
 
auto convertNotesToK7 (std::span< std::vector< charts::BmsNotesData::Note > > &notes) -> void
 
auto generatePermutation (std::span< std::vector< charts::BmsNotesData::Note > > &notes, resource_managers::NoteOrderAlgorithm algorithm, uint64_t seed, bool k5, bool usePre130) -> ShuffleResult
 Generate a permutation of notes.
 
auto eraseFirst (std::vector< int > &lanes, const int value) -> void
 
auto isPlayableTimelineNote (const Note &note) -> bool
 
auto makeSourceForDest (const int numCols, const std::unordered_map< int, int > &permutationMap) -> TimelinePermutation
 
void applyTimelinePermutations (std::span< std::vector< Note > > notes, const std::vector< Timeline > &timelines, const std::vector< TimelinePermutation > &permutations)
 
ShuffleResult makeIdentityResult (int64_t seed, int numCols)
 
auto makeModifyLanes (int numCols, int scratchCol, bool includeScratch) -> std::vector< int >
 
auto makeLaneIdentity (int numCols) -> QList< int >
 
auto applyLanePermutation (std::span< std::vector< Note > > notes, const QList< int > &columns) -> void
 
auto lr2LaneToColumn (const int lane, const int keyCount) -> int
 
auto generateLr2LanePermutation (std::span< std::vector< Note > > notes, resource_managers::NoteOrderAlgorithm algorithm, Lr2Random &rng) -> ShuffleResult
 
auto generateBeatorajaLanePermutation (std::span< std::vector< Note > > notes, resource_managers::NoteOrderAlgorithm algorithm, int64_t seed) -> ShuffleResult
 
auto mergePermutationMap (const std::unordered_map< int, int > &randomMap, const std::unordered_map< int, int > &lnActive) -> std::unordered_map< int, int >
 
auto isBeatorajaNoteOrderAlgorithm (resource_managers::NoteOrderAlgorithm algorithm) -> bool
 
auto isLr2NoteOrderAlgorithm (resource_managers::NoteOrderAlgorithm algorithm) -> bool
 
auto flipBeatorajaDpPlayfields (std::array< std::vector< charts::BmsNotesData::Note >, charts::BmsNotesData::columnNumber > &notes) -> void
 
auto flipLr2DpPlayfields (std::array< std::vector< charts::BmsNotesData::Note >, charts::BmsNotesData::columnNumber > &notes) -> void
 
auto generateBeatorajaLanePermutation (std::span< std::vector< charts::BmsNotesData::Note > > notes, resource_managers::NoteOrderAlgorithm algorithm, int64_t seed) -> ShuffleResult
 
auto generateLr2LanePermutation (std::span< std::vector< charts::BmsNotesData::Note > > notes, resource_managers::NoteOrderAlgorithm algorithm, Lr2Random &rng) -> ShuffleResult
 
template<std::size_t N, typename T >
requires requires { std::get<N>(std::declval<T>()); }
constexpr auto get (T &&t) -> auto &
 Returns the nth element of a type that supports std::get.
 
template<std::size_t N, typename T >
requires std::is_aggregate_v<std::remove_cvref_t<T>>
constexpr auto get (T &&aggregate) -> auto &
 Returns the nth member of an aggregate.
 
auto pathToQString (const std::filesystem::path &path) -> QString
 
auto pathToUtfString (const std::filesystem::path &path) -> std::string
 
auto qStringToPath (const QString &qString) -> std::filesystem::path
 
template<typename Factory = spdlog::synchronous_factory>
std::shared_ptr< spdlog::logger > qtLoggerMt (const std::string &logger_name, QObject *qt_object, const std::string &meta_method)
 
auto sha256 (const std::string_view str) -> Sha256
 
auto md5 (const std::string_view str) -> Md5
 
auto timingWindowsFromHash (const QHash< gameplay_logic::Judgement, QPair< qint64, qint64 > > &hash) -> gameplay_logic::rules::TimingWindows
 
auto toLower (char p) -> char
 
auto utfStringToPath (const std::string &utfString) -> std::filesystem::path
 
constexpr auto packVersion (const uint32_t major, const uint32_t minor, const uint32_t patch) -> int64_t
 
constexpr auto unpackVersion (const uint64_t version) -> std::tuple< uint32_t, uint32_t, uint32_t >
 

Variables

template<typename T >
constexpr auto tupleSizeV = TupleSize<T>::value
 
constexpr uint64_t currentVersion
 

Detailed Description

Contains various helper classes and functions.

Typedef Documentation

◆ DXArchive

using support::DXArchive = typedef std::map<std::string, DXArchiveSegment>

◆ Md5

using support::Md5 = typedef std::string

◆ Note

◆ NoteType

◆ QtSinkMt

using support::QtSinkMt = typedef QtSink<std::mutex>

◆ Sha256

using support::Sha256 = typedef std::string

Function Documentation

◆ applyLanePermutation()

auto support::applyLanePermutation ( std::span< std::vector< Note > >  notes,
const QList< int > &  columns 
) -> void

◆ applyTimelinePermutations()

void support::applyTimelinePermutations ( std::span< std::vector< Note > >  notes,
const std::vector< Timeline > &  timelines,
const std::vector< TimelinePermutation > &  permutations 
)

◆ capitalize()

auto support::capitalize ( std::string_view  str) -> std::string

◆ compress()

template<typename T >
auto support::compress ( const T &  data) -> QByteArray

◆ convertColumnsToK7()

auto support::convertColumnsToK7 ( QList< int > &  columns) -> void

◆ convertNotesToK7()

auto support::convertNotesToK7 ( std::span< std::vector< charts::BmsNotesData::Note > > &  notes) -> void

◆ convertTachiClearType()

QString support::convertTachiClearType ( const int  enumIndex)

◆ createQmlPropertyMap()

auto support::createQmlPropertyMap ( QObject *  parent) -> QQmlPropertyMap *

◆ decompress() [1/2]

template<typename T >
T support::decompress ( QByteArray  data)

◆ decompress() [2/2]

template<typename T >
void support::decompress ( QByteArray  data,
T &  out 
)

◆ eraseFirst()

auto support::eraseFirst ( std::vector< int > &  lanes,
const int  value 
) -> void

◆ extractDxaToFile()

auto support::extractDxaToFile ( const std::filesystem::path &  path)

◆ extractDxaToMem()

auto support::extractDxaToMem ( const std::filesystem::path &  path)

◆ fisherYatesShuffle()

template<typename T , typename Random >
void support::fisherYatesShuffle ( std::span< T >  arr,
Random &  randomGenerator,
bool  usePre130 
)

◆ flipBeatorajaDpPlayfields()

auto support::flipBeatorajaDpPlayfields ( std::array< std::vector< charts::BmsNotesData::Note >, charts::BmsNotesData::columnNumber > &  notes) -> void

◆ flipLr2DpPlayfields()

auto support::flipLr2DpPlayfields ( std::array< std::vector< charts::BmsNotesData::Note >, charts::BmsNotesData::columnNumber > &  notes) -> void

◆ folderName()

auto support::folderName ( QString  path) -> QString
inline

◆ generateBeatorajaLanePermutation() [1/2]

auto support::generateBeatorajaLanePermutation ( std::span< std::vector< charts::BmsNotesData::Note > >  notes,
resource_managers::NoteOrderAlgorithm  algorithm,
int64_t  seed 
) -> ShuffleResult

◆ generateBeatorajaLanePermutation() [2/2]

auto support::generateBeatorajaLanePermutation ( std::span< std::vector< Note > >  notes,
resource_managers::NoteOrderAlgorithm  algorithm,
int64_t  seed 
) -> ShuffleResult

◆ generateLr2LanePermutation() [1/2]

auto support::generateLr2LanePermutation ( std::span< std::vector< charts::BmsNotesData::Note > >  notes,
resource_managers::NoteOrderAlgorithm  algorithm,
Lr2Random &  rng 
) -> ShuffleResult

◆ generateLr2LanePermutation() [2/2]

auto support::generateLr2LanePermutation ( std::span< std::vector< Note > >  notes,
resource_managers::NoteOrderAlgorithm  algorithm,
Lr2Random &  rng 
) -> ShuffleResult

◆ generatePermutation()

auto support::generatePermutation ( std::span< std::vector< charts::BmsNotesData::Note > > &  notes,
resource_managers::NoteOrderAlgorithm  algorithm,
uint64_t  seed,
bool  k5,
bool  usePre130 
) -> ShuffleResult

Generate a permutation of notes.

The permutation is generated using the given algorithm and seed.

Warning
For S-Random, this function relies on total stability of note generation. If we ever change how we load notes, replays WILL break.
Parameters
notesThe notes to shuffle.
algorithmThe algorithm to use.
seedThe seed to use.
k5Whether to treat the notes 5k as 7k (legacy behavior)
usePre130Whether to use the broken pre-1.3.0 version of the s-random shuffle algorithm (legacy behavior)
Returns
The result of the shuffle, including the new seed and the new column order.

◆ get() [1/2]

template<std::size_t N, typename T >
requires std::is_aggregate_v<std::remove_cvref_t<T>>
constexpr auto support::get ( T &&  aggregate) -> auto&
constexpr

Returns the nth member of an aggregate.

Template Parameters
NIndex of the element to get.
TType of the aggregate.
Parameters
aggregateAggregate to get the element from.
Returns
A reference to nth member of the aggregate.

◆ get() [2/2]

template<std::size_t N, typename T >
requires requires { std::get<N>(std::declval<T>()); }
constexpr auto support::get ( T &&  t) -> auto&
constexpr

Returns the nth element of a type that supports std::get.

Template Parameters
NIndex of the element to get.
TType of the object to get the element from.
Parameters
tObject to get the element from.
Returns
A reference to nth element of the object.

◆ getColumsIota()

auto support::getColumsIota ( const int  size) -> QList<int>

◆ getNextNote()

auto support::getNextNote ( const std::span< std::vector< charts::BmsNotesData::Note > >  arr,
std::vector< std::vector< charts::BmsNotesData::Note >::const_iterator > &  noteIters 
) -> std::optional<std::vector<charts::BmsNotesData::Note>::const_iterator>

◆ isBeatorajaNoteOrderAlgorithm()

auto support::isBeatorajaNoteOrderAlgorithm ( resource_managers::NoteOrderAlgorithm  algorithm) -> bool

◆ isLr2NoteOrderAlgorithm()

auto support::isLr2NoteOrderAlgorithm ( resource_managers::NoteOrderAlgorithm  algorithm) -> bool

◆ isPlayableTimelineNote()

auto support::isPlayableTimelineNote ( const Note &  note) -> bool

◆ lr2LaneToColumn()

auto support::lr2LaneToColumn ( const int  lane,
const int  keyCount 
) -> int

◆ makeIdentityResult()

ShuffleResult support::makeIdentityResult ( int64_t  seed,
int  numCols 
)

◆ makeLaneIdentity()

auto support::makeLaneIdentity ( int  numCols) -> QList<int>

◆ makeModifyLanes()

auto support::makeModifyLanes ( int  numCols,
int  scratchCol,
bool  includeScratch 
) -> std::vector<int>

◆ makeSourceForDest()

auto support::makeSourceForDest ( const int  numCols,
const std::unordered_map< int, int > &  permutationMap 
) -> TimelinePermutation

◆ md5()

auto support::md5 ( const std::string_view  str) -> Md5

◆ mergePermutationMap()

auto support::mergePermutationMap ( const std::unordered_map< int, int > &  randomMap,
const std::unordered_map< int, int > &  lnActive 
) -> std::unordered_map<int, int>

◆ normalizeDxaPath()

auto support::normalizeDxaPath ( const std::filesystem::path &  path) -> std::string

◆ packVersion()

constexpr auto support::packVersion ( const uint32_t  major,
const uint32_t  minor,
const uint32_t  patch 
) -> int64_t
constexpr

◆ pathToQString()

auto support::pathToQString ( const std::filesystem::path &  path) -> QString

◆ pathToUtfString()

auto support::pathToUtfString ( const std::filesystem::path &  path) -> std::string

◆ pushNoteWithMaxDistance()

void support::pushNoteWithMaxDistance ( const std::vector< charts::BmsNotesData::Note >::const_iterator &  noteIt,
const QList< int > &  columnsIota,
std::vector< std::vector< charts::BmsNotesData::Note > > &  newColumns 
)

◆ pushProposedNote()

auto support::pushProposedNote ( std::vector< charts::BmsNotesData::Note > &  lane,
const std::vector< charts::BmsNotesData::Note >::const_iterator &  note 
) -> void

◆ qStringToPath()

auto support::qStringToPath ( const QString &  qString) -> std::filesystem::path

◆ qtLoggerMt()

template<typename Factory = spdlog::synchronous_factory>
std::shared_ptr< spdlog::logger > support::qtLoggerMt ( const std::string &  logger_name,
QObject *  qt_object,
const std::string &  meta_method 
)
inline

◆ sha256()

auto support::sha256 ( const std::string_view  str) -> Sha256

◆ shuffleAllNotes()

template<typename Random >
void support::shuffleAllNotes ( std::span< std::vector< charts::BmsNotesData::Note > >  arr,
const std::chrono::nanoseconds  preferredNoteDistance,
Random &  randomGenerator,
bool  usePre130 
)

◆ timingWindowsFromHash()

auto support::timingWindowsFromHash ( const QHash< gameplay_logic::Judgement, QPair< qint64, qint64 > > &  hash) -> gameplay_logic::rules::TimingWindows

◆ toLower()

auto support::toLower ( char  p) -> char
inline

◆ tryPushingNoteWithDistance()

auto support::tryPushingNoteWithDistance ( const std::vector< charts::BmsNotesData::Note >::const_iterator &  noteIt,
const QList< int > &  columnsIota,
std::vector< std::vector< charts::BmsNotesData::Note > > &  newColumns,
const std::chrono::nanoseconds  preferredNoteDistance 
) -> bool

◆ unpackVersion()

constexpr auto support::unpackVersion ( const uint64_t  version) -> std::tuple<uint32_t, uint32_t, uint32_t>
constexpr

◆ utfStringToPath()

auto support::utfStringToPath ( const std::string &  utfString) -> std::filesystem::path

Variable Documentation

◆ currentVersion

constexpr uint64_t support::currentVersion
constexpr
Initial value:
= packVersion(RHYTHMGAME_VERSION_MAJOR,
RHYTHMGAME_VERSION_MINOR,
RHYTHMGAME_VERSION_PATCH)
constexpr auto packVersion(const uint32_t major, const uint32_t minor, const uint32_t patch) -> int64_t
Definition Version.h:12

◆ tupleSizeV

template<typename T >
constexpr auto support::tupleSizeV = TupleSize<T>::value
constexpr