Began writing Compress for ROM
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
|
||||
#define BUILD_HEADER(command, length) (command << 5) + (length - 1)
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -29,6 +31,10 @@ constexpr int kCommandByteFill = 1;
|
||||
constexpr int kCommandWordFill = 2;
|
||||
constexpr int kCommandIncreasingFill = 3;
|
||||
constexpr int kCommandRepeatingBytes = 4;
|
||||
constexpr int kMaxLengthNormalHeader = 32;
|
||||
constexpr int kMaxLengthCompression = 1024;
|
||||
constexpr int kNintendoMode1 = 0;
|
||||
constexpr int kNintendoMode2 = 1;
|
||||
constexpr uchar kGraphicsBitmap[8] = {0x80, 0x40, 0x20, 0x10,
|
||||
0x08, 0x04, 0x02, 0x01};
|
||||
|
||||
@@ -40,6 +46,23 @@ struct OWMapTiles {
|
||||
OWBlockset special_world; // 32 maps
|
||||
} typedef OWMapTiles;
|
||||
|
||||
typedef struct s_compression_piece compression_piece;
|
||||
|
||||
struct s_compression_piece {
|
||||
char command;
|
||||
unsigned int length;
|
||||
char* argument;
|
||||
unsigned int argument_length;
|
||||
compression_piece* next;
|
||||
};
|
||||
|
||||
struct CompressionPiece {
|
||||
uchar command;
|
||||
uint length;
|
||||
uchar* argument;
|
||||
uint argument_length;
|
||||
};
|
||||
|
||||
class ROM {
|
||||
public:
|
||||
absl::Status LoadFromFile(const absl::string_view& filename);
|
||||
@@ -48,6 +71,11 @@ class ROM {
|
||||
|
||||
// absl::Status SaveOverworld();
|
||||
|
||||
absl::StatusOr<Bytes> CompressGraphics(const uint pos, const uint length);
|
||||
absl::StatusOr<Bytes> CompressOverworld(const uint pos, const uint length);
|
||||
absl::StatusOr<Bytes> Compress(const uint start, const uint length,
|
||||
char mode);
|
||||
|
||||
absl::StatusOr<Bytes> DecompressGraphics(int pos, int size);
|
||||
absl::StatusOr<Bytes> DecompressOverworld(int pos, int size);
|
||||
absl::StatusOr<Bytes> Decompress(int offset, int size = 0x800,
|
||||
|
||||
Reference in New Issue
Block a user