yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
patch_manager.h
Go to the documentation of this file.
1#ifndef YAZE_CORE_PATCH_PATCH_MANAGER_H
2#define YAZE_CORE_PATCH_PATCH_MANAGER_H
3
4#include <memory>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
10
11namespace yaze {
12class Rom;
13}
14
15namespace yaze::core {
16
37 public:
38 PatchManager() = default;
39
45 absl::Status LoadPatches(const std::string& patches_dir);
46
50 absl::Status ReloadPatches();
51
55 const std::vector<std::string>& folders() const { return folders_; }
56
62 std::vector<AsmPatch*> GetPatchesInFolder(const std::string& folder);
63
70 AsmPatch* GetPatch(const std::string& folder, const std::string& filename);
71
75 const std::vector<std::unique_ptr<AsmPatch>>& patches() const {
76 return patches_;
77 }
78
82 int GetEnabledPatchCount() const;
83
89 absl::Status ApplyEnabledPatches(Rom* rom);
90
99 absl::Status GenerateCombinedPatch(const std::string& output_path);
100
105 absl::Status SaveAllPatches();
106
112 absl::Status CreatePatchFolder(const std::string& folder_name);
113
119 absl::Status RemovePatchFolder(const std::string& folder_name);
120
127 absl::Status AddPatchFile(const std::string& source_path,
128 const std::string& target_folder);
129
136 absl::Status RemovePatchFile(const std::string& folder,
137 const std::string& filename);
138
142 const std::string& patches_directory() const { return patches_directory_; }
143
147 bool is_loaded() const { return is_loaded_; }
148
149 private:
155 void ScanDirectory(const std::string& dir_path, const std::string& folder_name);
156
157 std::vector<std::string> folders_;
158 std::vector<std::unique_ptr<AsmPatch>> patches_;
160 bool is_loaded_ = false;
161};
162
163} // namespace yaze::core
164
165#endif // YAZE_CORE_PATCH_PATCH_MANAGER_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
Represents a ZScream-compatible ASM patch file.
Definition asm_patch.h:74
Manages a collection of ZScream-compatible ASM patches.
absl::Status ApplyEnabledPatches(Rom *rom)
Apply all enabled patches to a ROM.
absl::Status RemovePatchFile(const std::string &folder, const std::string &filename)
Remove a patch file.
std::vector< std::string > folders_
void ScanDirectory(const std::string &dir_path, const std::string &folder_name)
Scan a directory for .asm files.
absl::Status AddPatchFile(const std::string &source_path, const std::string &target_folder)
Add a patch file from an external source.
AsmPatch * GetPatch(const std::string &folder, const std::string &filename)
Get a specific patch by folder and filename.
absl::Status SaveAllPatches()
Save all patches to their files.
bool is_loaded() const
Check if patches have been loaded.
const std::vector< std::string > & folders() const
Get list of patch folder names.
int GetEnabledPatchCount() const
Get count of enabled patches.
std::vector< AsmPatch * > GetPatchesInFolder(const std::string &folder)
Get all patches in a specific folder.
absl::Status CreatePatchFolder(const std::string &folder_name)
Create a new patch folder.
absl::Status ReloadPatches()
Reload patches from the current directory.
const std::string & patches_directory() const
Get the patches directory path.
const std::vector< std::unique_ptr< AsmPatch > > & patches() const
Get all loaded patches.
std::vector< std::unique_ptr< AsmPatch > > patches_
absl::Status LoadPatches(const std::string &patches_dir)
Load all patches from a directory structure.
absl::Status RemovePatchFolder(const std::string &folder_name)
Remove a patch folder and all its contents.
absl::Status GenerateCombinedPatch(const std::string &output_path)
Generate a combined .asm file that includes all enabled patches.