A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KartParamFileManager.hh
1#pragma once
2
3#include "game/kart/KartParam.hh"
4
5#include "game/system/ResourceManager.hh"
6
7namespace Kart {
8
13public:
14 void clear();
15 void init();
16 [[nodiscard]] EGG::RamStream getDriverStream(Character character) const;
17 [[nodiscard]] EGG::RamStream getVehicleStream(Vehicle vehicle) const;
18 [[nodiscard]] EGG::RamStream getHitboxStream(Vehicle vehicle) const;
19 [[nodiscard]] EGG::RamStream getBikeDispParamsStream(Vehicle vehicle) const;
20
21 static KartParamFileManager *CreateInstance();
22 static void DestroyInstance();
23
24 [[nodiscard]] static KartParamFileManager *Instance() {
25 return s_instance;
26 }
27
28private:
29 template <typename T>
30 struct ParamFile {
31 u32 count;
32 T params[];
33 };
34
35 struct FileInfo {
36 void clear() {
37 file = nullptr;
38 size = 0;
39 }
40
41 void load(const char *filename) {
42 auto *resourceManager = System::ResourceManager::Instance();
43 file = resourceManager->getFile(filename, &size, System::ArchiveId::Core);
44 }
45
46 void *file;
47 size_t size;
48 };
49
51 ~KartParamFileManager() override;
52
53 [[nodiscard]] bool validate() const;
54
55 FileInfo m_kartParam; // kartParam.bin
56 FileInfo m_driverParam; // driverParam.bin
57 FileInfo m_bikeDispParam; // bikePartsDispParam.bin
58
59 static KartParamFileManager *s_instance;
60};
61
62} // namespace Kart
An interface for ensuring certain structures and classes are destroyed with the heap.
Definition Disposer.hh:11
A stream of data stored in memory.
Definition Stream.hh:64
Abstraction for the process of retrieving kart parameters from files.
void init()
Loads and validates the kart parameter files.
bool validate() const
Performs a few checks to make sure the files were loaded successfully.
Pertains to kart-related functionality.