yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
graphics_sheet_sync.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_GRAPHICS_SHEET_SYNC_H
2#define YAZE_APP_EDITOR_GRAPHICS_GRAPHICS_SHEET_SYNC_H
3
4#include <cstddef>
5#include <cstdint>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "absl/types/span.h"
10
11namespace yaze {
12namespace zelda3 {
13class GraphicsSheetStore;
14struct GameData;
15} // namespace zelda3
16
17namespace editor {
18
19class GraphicsEditorState;
20
33 uint16_t sheet = 0;
34 std::vector<uint16_t> offsets; // y * 128 + x
35 std::vector<uint8_t> before;
36 std::vector<uint8_t> after;
37
38 bool empty() const { return offsets.empty(); }
39 size_t MemoryUsage() const {
40 return offsets.size() * sizeof(uint16_t) + before.size() + after.size();
41 }
42};
43
45SheetPixelDiff MakeSheetPixelDiff(uint16_t sheet,
46 absl::Span<const uint8_t> before,
47 absl::Span<const uint8_t> after);
48
51void AttachSheetStore(GraphicsEditorState& state, zelda3::GameData* game_data);
52
55zelda3::GraphicsSheetStore* ActiveSheetStore(const GraphicsEditorState& state);
56
59void RefreshArenaSheet(GraphicsEditorState& state, uint16_t sheet);
60
63absl::Status CommitSheetPixels(GraphicsEditorState& state, uint16_t sheet,
64 absl::Span<const uint8_t> pixels);
65
68absl::Status ApplySheetPixelDiff(GraphicsEditorState& state,
69 const SheetPixelDiff& diff, bool redo);
70
73int SyncArenaFromStore(GraphicsEditorState& state);
74
75} // namespace editor
76} // namespace yaze
77
78#endif // YAZE_APP_EDITOR_GRAPHICS_GRAPHICS_SHEET_SYNC_H
zelda3::GraphicsSheetStore * ActiveSheetStore(const GraphicsEditorState &state)
int SyncArenaFromStore(GraphicsEditorState &state)
absl::Status CommitSheetPixels(GraphicsEditorState &state, uint16_t sheet, absl::Span< const uint8_t > pixels)
void AttachSheetStore(GraphicsEditorState &state, zelda3::GameData *game_data)
void RefreshArenaSheet(GraphicsEditorState &state, uint16_t sheet)
absl::Status ApplySheetPixelDiff(GraphicsEditorState &state, const SheetPixelDiff &diff, bool redo)
SheetPixelDiff MakeSheetPixelDiff(uint16_t sheet, absl::Span< const uint8_t > before, absl::Span< const uint8_t > after)
The pixels that differ between two 4096-byte sheets.
The pixels one undo step changes in one sheet.
std::vector< uint16_t > offsets
std::vector< uint8_t > before