diff --git a/src/app/rom.cc b/src/app/rom.cc index 139f37ab..e3cd4f90 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -295,14 +296,13 @@ Bytes CreateCompressionString(std::shared_ptr& start, } absl::Status ValidateCompressionResult( - std::shared_ptr& compressed_chain_start, int mode, - int start, int src_data_pos) { + CompressionPiecePointer& compressed_chain_start, int mode, int start, + int src_data_pos) { if (compressed_chain_start->next != nullptr) { ROM temp_rom; RETURN_IF_ERROR(temp_rom.LoadFromBytes( CreateCompressionString(compressed_chain_start->next, mode))) - ASSIGN_OR_RETURN(auto decomp_data, - temp_rom.Decompress(0, temp_rom.size())) + ASSIGN_OR_RETURN(auto decomp_data, temp_rom.Decompress(0, temp_rom.size())) if (!std::equal(decomp_data.begin() + start, decomp_data.end(), temp_rom.begin())) { return absl::InternalError(absl::StrFormat( @@ -314,9 +314,8 @@ absl::Status ValidateCompressionResult( } // Merge consecutive copy if possible -std::shared_ptr MergeCopy( - std::shared_ptr& start) { - std::shared_ptr piece = start; +CompressionPiecePointer MergeCopy(CompressionPiecePointer& start) { + CompressionPiecePointer piece = start; while (piece != nullptr) { if (piece->command == kCommandDirectCopy && piece->next != nullptr && @@ -371,7 +370,7 @@ Bytes SnesTo8bppSheet(Bytes sheet, int bpp) { for (int i = 0; i < num_tiles; i++) { // for each tiles, 16 per line for (int y = 0; y < 8; y++) { // for each line for (int x = 0; x < 8; x++) { //[0] + [1] + [16] - auto b1 = ((sheet[(y * 2) + (bpp * pos)] & (kGraphicsBitmap[x]))); + auto b1 = (sheet[(y * 2) + (bpp * pos)] & (kGraphicsBitmap[x])); auto b2 = (sheet[((y * 2) + (bpp * pos)) + 1] & (kGraphicsBitmap[x])); auto b3 = (sheet[(16 + y) + (bpp * pos)] & (kGraphicsBitmap[x])); unsigned char b = 0; @@ -384,7 +383,7 @@ Bytes SnesTo8bppSheet(Bytes sheet, int bpp) { if (b3 != 0 && bpp != 16) { b |= 4; } - sheet_buffer_out[x + (xx) + (y * 128) + (yy * 1024)] = b; + sheet_buffer_out[x + xx + (y * 128) + (yy * 1024)] = b; } } pos++; diff --git a/src/app/rom.h b/src/app/rom.h index a0a93024..be1af8ff 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -66,6 +66,7 @@ struct CompressionPiece { : command(cmd), length(len), argument_length(arg_len), argument(args) {} }; using CompressionPiece = struct CompressionPiece; +using CompressionPiecePointer = std::shared_ptr; class ROM { public: diff --git a/src/app/zelda3/inventory.cc b/src/app/zelda3/inventory.cc index e5856b2e..d97a5bd7 100644 --- a/src/app/zelda3/inventory.cc +++ b/src/app/zelda3/inventory.cc @@ -8,6 +8,7 @@ namespace yaze { namespace app { namespace zelda3 { + void Inventory::Create() { data_.reserve(256 * 256); for (int i = 0; i < 256 * 256; i++) {