RhythmGame 1.4.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
qml_components::ChartLoader Class Reference

Loads charts and courses with the given parameters. More...

#include <ChartLoader.h>

Inheritance diagram for qml_components::ChartLoader:
Inheritance graph
[legend]
Collaboration diagram for qml_components::ChartLoader:
Collaboration graph
[legend]

Public Types

using GaugeFactory = std::function< QList< gameplay_logic::rules::BmsGauge * >(resource_managers::Profile *profile, double total, int noteCount)>
 
using GaugeFactoryCourse = std::function< QList< gameplay_logic::rules::BmsGauge * >(resource_managers::Profile *profile, const QHash< QString, double > &initialValues)>
 
using HitValueFactory = std::function< double(std::chrono::nanoseconds, gameplay_logic::Judgement)>
 
using FindChartPath = std::function< std::optional< std::filesystem::path >(const QString &hash, const std::filesystem::path &hint)>
 

Public Member Functions

 ChartLoader (ProfileList *profileList, input::InputTranslator *inputTranslator, resource_managers::ChartDataFactory *chartDataFactory, resource_managers::SongAssetStore *assetStore, HitValueFactory hitValueFactory, GaugeFactory gaugeFactory, GaugeFactoryCourse gaugeFactoryCourse, FindChartPath findChartPath, resource_managers::ChartFactory *chartFactory, db::SqliteCppDb *db, QObject *parent=nullptr)
 
Q_INVOKABLE gameplay_logic::ChartRunner * loadChart (const QString &filename, resource_managers::Profile *player1, bool player1AutoPlay, bool player1Replay, gameplay_logic::BmsScore *score1, resource_managers::Profile *player2, bool player2AutoPlay, bool player2Replay, gameplay_logic::BmsScore *score2) const
 Loads a chart with the given parameters.
 
auto loadChartWithConfig (const QString &filename, resource_managers::Profile *player, const resource_managers::ChartPlayConfig &playConfig) const -> gameplay_logic::ChartRunner *
 
Q_INVOKABLE bool canRetry (gameplay_logic::ChartRunner *current) const
 
Q_INVOKABLE gameplay_logic::ChartRunner * retryChart (gameplay_logic::ChartRunner *current, bool samePattern) const
 
Q_INVOKABLE gameplay_logic::CourseRunner * loadCourse (const resource_managers::Course &course, resource_managers::Profile *player1, bool player1AutoPlay, bool player1Replay, gameplay_logic::BmsScoreCourse *score1, resource_managers::Profile *player2, bool player2AutoPlay, bool player2Replay, gameplay_logic::BmsScoreCourse *score2) const
 Loads a course with the given parameters.
 
Q_INVOKABLE gameplay_logic::ChartData * loadChartData (const QString &filename, const QString &identifier="", QList< int64_t > randomSequence={}) const
 
Q_INVOKABLE QVariantMap loadChartDataFromDb (QList< QString > identifiers) const
 Loads chart datas for multiple charts from the database.
 

Detailed Description

Loads charts and courses with the given parameters.

This class is how a theme to load charts and courses.

Member Typedef Documentation

◆ FindChartPath

using qml_components::ChartLoader::FindChartPath = std::function<std::optional<std::filesystem::path>( const QString& hash, const std::filesystem::path& hint)>

◆ GaugeFactory

using qml_components::ChartLoader::GaugeFactory = std::function<QList<gameplay_logic::rules::BmsGauge*>( resource_managers::Profile* profile, double total, int noteCount)>

◆ GaugeFactoryCourse

using qml_components::ChartLoader::GaugeFactoryCourse = std::function<QList<gameplay_logic::rules::BmsGauge*>( resource_managers::Profile* profile, const QHash<QString, double>& initialValues)>

◆ HitValueFactory

using qml_components::ChartLoader::HitValueFactory = std::function<double(std::chrono::nanoseconds, gameplay_logic::Judgement)>

Constructor & Destructor Documentation

◆ ChartLoader()

qml_components::ChartLoader::ChartLoader ( ProfileList *  profileList,
input::InputTranslator *  inputTranslator,
resource_managers::ChartDataFactory *  chartDataFactory,
resource_managers::SongAssetStore *  assetStore,
HitValueFactory  hitValueFactory,
GaugeFactory  gaugeFactory,
GaugeFactoryCourse  gaugeFactoryCourse,
FindChartPath  findChartPath,
resource_managers::ChartFactory *  chartFactory,
db::SqliteCppDb *  db,
QObject *  parent = nullptr 
)

Member Function Documentation

◆ canRetry()

auto qml_components::ChartLoader::canRetry ( gameplay_logic::ChartRunner *  current) const

Whether this is a single-player chart without autoplay or replay.

◆ loadChart()

auto qml_components::ChartLoader::loadChart ( const QString &  filename,
resource_managers::Profile *  player1,
bool  player1AutoPlay,
bool  player1Replay,
gameplay_logic::BmsScore *  score1,
resource_managers::Profile *  player2,
bool  player2AutoPlay,
bool  player2Replay,
gameplay_logic::BmsScore *  score2 
) const

Loads a chart with the given parameters.

Parameters
filenameThe path to the chart file.
player1The first player profile.
player1AutoPlayWhether the first player is in auto-play mode.
player1ReplayWhether the first player is in replay mode.
score1The score to replay for the first player, optional. Incompatible with auto-play.
player2The second player profile, can be nullptr for single-player.
player2AutoPlayWhether the second player is in auto-play mode.
player2ReplayWhether the second player is in replay mode.
score2The score to replay for the second player. Incompatible with auto-play.
Returns
A pointer to the loaded chart, or nullptr on failure.

If score is not null and replay is false, the game will load the chart with the same settings the score (G-Battle).

◆ loadChartData()

gameplay_logic::ChartData * qml_components::ChartLoader::loadChartData ( const QString &  filename,
const QString &  identifier = "",
QList< int64_t >  randomSequence = {} 
) const
Parameters
filenameThe path to the chart file, optional if identifier is given.
identifierAn MD5 hash or sha256/<hash>, optional if filename is given.
randomSequenceThe #RANDOM sequence to use for the chart, optional.
Returns
The chart data, loaded from the BMS file, or nullptr on failure.

◆ loadChartDataFromDb()

auto qml_components::ChartLoader::loadChartDataFromDb ( QList< QString >  identifiers) const

Loads chart datas for multiple charts from the database.

Parameters
identifiersMD5 hashes or sha256/<hash> identifiers.
Returns
A map from identifier to chart data. Hashes are uppercase and the SHA256 prefix is lowercase. If an identifier was not in the database, it will not be present in the map.

◆ loadChartWithConfig()

auto qml_components::ChartLoader::loadChartWithConfig ( const QString &  filename,
resource_managers::Profile *  player,
const resource_managers::ChartPlayConfig &  playConfig 
) const -> gameplay_logic::ChartRunner*

Loads a single-player chart with an explicit immutable transformation. This path never reads or writes the profile's note-order/DP options.

◆ loadCourse()

gameplay_logic::CourseRunner * qml_components::ChartLoader::loadCourse ( const resource_managers::Course &  course,
resource_managers::Profile *  player1,
bool  player1AutoPlay,
bool  player1Replay,
gameplay_logic::BmsScoreCourse *  score1,
resource_managers::Profile *  player2,
bool  player2AutoPlay,
bool  player2Replay,
gameplay_logic::BmsScoreCourse *  score2 
) const

Loads a course with the given parameters.

Parameters
courseThe course to load.
player1The first player profile.
player1AutoPlayWhether the first player is in auto-play mode.
score1The score to replay for the first player, optional. Incompatible with auto-play.
player2The second player profile, can be nullptr for single-player.
player2AutoPlayWhether the second player is in auto-play mode.
score2The score to replay for the second player. Incompatible with auto-play.
Returns
A pointer to the loaded course, or nullptr on failure.

◆ retryChart()

auto qml_components::ChartLoader::retryChart ( gameplay_logic::ChartRunner *  current,
bool  samePattern 
) const

Creates a new runner without stopping, finishing or saving current. Same-pattern retry preserves the chart's random branches and lane transformation. Otherwise the current profile options are used. Returns nullptr when unsupported or loading fails. The caller owns the new runner; Arena eligibility and screen navigation are caller policies.


The documentation for this class was generated from the following files: