From f3778b58bb170208673d70d55459255af6093792 Mon Sep 17 00:00:00 2001 From: Sour Date: Sat, 15 Sep 2018 09:59:17 -0400 Subject: [PATCH] HD Packs: Use hex format for tile indexes (CHR ROM) (Easier to map the tile indexes with bank/column/row numbers) --- Core/HdData.h | 2 +- Core/HdPackLoader.cpp | 6 +++++- Docs/content/hdpacks/_index.md | 5 +++-- GUI.NET/Debugger/HdPackCopyHelper.cs | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Core/HdData.h b/Core/HdData.h index 3a028cc1..3e8c3e3a 100644 --- a/Core/HdData.h +++ b/Core/HdData.h @@ -278,7 +278,7 @@ struct HdPackTileInfo : public HdTileKey } else { out << "" << pngIndex << "," << - TileIndex << "," << + HexUtilities::ToHex(TileIndex) << "," << HexUtilities::ToHex(PaletteColors, true) << "," << X << "," << Y << "," << diff --git a/Core/HdPackLoader.cpp b/Core/HdPackLoader.cpp index b3c4ce48..d58edb33 100644 --- a/Core/HdPackLoader.cpp +++ b/Core/HdPackLoader.cpp @@ -298,7 +298,11 @@ void HdPackLoader::ProcessTileTag(vector &tokens, vectorIsChrRamTile = true; tileInfo->TileIndex = -1; } else { - tileInfo->TileIndex = std::stoi(tileData); + if(_data->Version <= 102) { + tileInfo->TileIndex = std::stoi(tileData); + } else { + tileInfo->TileIndex = HexUtilities::FromHex(tileData); + } tileInfo->IsChrRamTile = false; } tileInfo->PaletteColors = HexUtilities::FromHex(tokens[index++]); diff --git a/Docs/content/hdpacks/_index.md b/Docs/content/hdpacks/_index.md index 55150f8d..8587e4bd 100644 --- a/Docs/content/hdpacks/_index.md +++ b/Docs/content/hdpacks/_index.md @@ -173,10 +173,10 @@ The condition is true when the following expression is true: ### <tile> tag ### **Syntax**: `[img index - integer], [tile data], [palette data], [x - integer], [y - integer], [brightness - 0.0 to 1.0], [default tile - Y or N]` -**Example (CHR ROM)**: `0,20,FF16360F,0,0,1,N` +**Example (CHR ROM)**: `0,2E,FF16360F,0,0,1,N` **Example (CHR RAM)**: `0,0E0E079C1E3EA7076101586121010000,0F100017,176,1168,1,N` -For CHR ROM games, `tile data` is an integer representing the position of the original tile in CHR ROM. +For CHR ROM games, `tile data` is an integer (in hexadecimal) representing the position of the original tile in CHR ROM. For CHR RAM games, `tile data` is a 32-character hexadecimal string representing all 16 bytes of the tile. `palette data` is always an 8-character hexadecimal string representing all 4 bytes of the palette used for the tile. For sprites, the first byte is always "FF". @@ -305,6 +305,7 @@ These registers return the ASCII string `NEA` (NES Enhanced Audio) - this can be ### Version 103 ### * Added a `Mask` parameter to the memoryCheck and memoryCheckConstant conditions +* Tile indexes for the `` tag are now in hex instead of decimal (affects CHR ROM games only) ### Version 102 ### diff --git a/GUI.NET/Debugger/HdPackCopyHelper.cs b/GUI.NET/Debugger/HdPackCopyHelper.cs index ef6bbba2..b57a8fbd 100644 --- a/GUI.NET/Debugger/HdPackCopyHelper.cs +++ b/GUI.NET/Debugger/HdPackCopyHelper.cs @@ -45,7 +45,7 @@ namespace Mesen.GUI.Debugger sb.Append(_ppuMemory[tileAddr + i].ToString("X2")); } } else { - sb.Append(_absoluteTileIndexes[tileAddr / 16].ToString()); + sb.Append(_absoluteTileIndexes[tileAddr / 16].ToString("X2")); } }