Merge pull request #21 from mkwong98/master

HD Pack module related updates
This commit is contained in:
NovaSquirrel 2021-02-20 00:01:09 -05:00 committed by GitHub
commit c252d1cff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 150 additions and 35 deletions

View file

@ -1243,7 +1243,7 @@ void Console::LoadHdPack(VirtualFile &romFile, VirtualFile &patchFile)
}
}
void Console::StartRecordingHdPack(string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize)
void Console::StartRecordingHdPack(string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, uint32_t outTileType)
{
ConsolePauseHelper helper(this);
@ -1251,7 +1251,7 @@ void Console::StartRecordingHdPack(string saveFolder, ScaleFilterType filterType
SaveState(saveState);
_hdPackBuilder.reset();
_hdPackBuilder.reset(new HdPackBuilder(shared_from_this(), saveFolder, filterType, scale, flags, chrRamBankSize, !_mapper->HasChrRom()));
_hdPackBuilder.reset(new HdPackBuilder(shared_from_this(), saveFolder, filterType, scale, flags, chrRamBankSize, outTileType, !_mapper->HasChrRom()));
_memoryManager->UnregisterIODevice(_ppu.get());
_ppu.reset();

View file

@ -227,7 +227,7 @@ public:
shared_ptr<HdPackData> GetHdData();
bool IsHdPpu();
void StartRecordingHdPack(string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize);
void StartRecordingHdPack(string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, uint32_t outTileType);
void StopRecordingHdPack();
void CopyRewindData(shared_ptr<Console> sourceConsole);

View file

@ -77,7 +77,7 @@ protected:
}
_console->GetMapper()->CopyChrTile(_lastSprite->AbsoluteTileAddr & 0xFFFFFFF0, sprite.TileData);
_hdPackBuilder->ProcessTile(_cycle - 1, _scanline, _lastSprite->AbsoluteTileAddr, sprite, mapper, false, _bankHashes[_lastSprite->TileAddr / _chrRamBankSize], false);
_hdPackBuilder->ProcessTile(_cycle - 1, _scanline, _lastSprite->AbsoluteTileAddr, sprite, mapper, _bankHashes[_lastSprite->TileAddr / _chrRamBankSize], false);
}
}
@ -91,7 +91,7 @@ protected:
tile.OffsetY = lastTile->OffsetY;
_console->GetMapper()->CopyChrTile(lastTile->AbsoluteTileAddr & 0xFFFFFFF0, tile.TileData);
_hdPackBuilder->ProcessTile(_cycle - 1, _scanline, lastTile->AbsoluteTileAddr, tile, mapper, false, _bankHashes[lastTile->TileAddr / _chrRamBankSize], hasBgSprite);
_hdPackBuilder->ProcessTile(_cycle - 1, _scanline, lastTile->AbsoluteTileAddr, tile, mapper, _bankHashes[lastTile->TileAddr / _chrRamBankSize], hasBgSprite);
}
}
} else {

View file

@ -332,9 +332,6 @@ HdPackTileInfo* HdNesPack::GetCachedMatchingTile(uint32_t x, uint32_t y, HdPpuTi
HdPackTileInfo* HdNesPack::GetMatchingTile(uint32_t x, uint32_t y, HdPpuTileInfo* tile, bool* disableCache)
{
auto hdTile = _hdData->TileByKey.find(*tile);
if(hdTile == _hdData->TileByKey.end()) {
hdTile = _hdData->TileByKey.find(tile->GetKey(true));
}
if(hdTile != _hdData->TileByKey.end()) {
for(HdPackTileInfo* hdPackTile : hdTile->second) {
@ -348,6 +345,20 @@ HdPackTileInfo* HdNesPack::GetMatchingTile(uint32_t x, uint32_t y, HdPpuTileInfo
}
}
//repeat with default if not found
hdTile = _hdData->TileByKey.find(tile->GetKey(true));
if (hdTile != _hdData->TileByKey.end()) {
for (HdPackTileInfo* hdPackTile : hdTile->second) {
if (disableCache != nullptr && hdPackTile->ForceDisableCache) {
*disableCache = true;
}
if (hdPackTile->MatchesCondition(_hdScreenInfo, x, y, tile)) {
return hdPackTile;
}
}
}
return nullptr;
}

View file

@ -9,6 +9,13 @@
HdPackBuilder* HdPackBuilder::_instance = nullptr;
enum HDPackOuputTileType
{
Both = 0,
BG = 1,
Sprite = 2
};
enum HdPackRecordFlags
{
None = 0,
@ -19,7 +26,7 @@ enum HdPackRecordFlags
SaveFrame = 16,
};
HdPackBuilder::HdPackBuilder(shared_ptr<Console> console, string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, bool isChrRam)
HdPackBuilder::HdPackBuilder(shared_ptr<Console> console, string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, uint32_t outTileType, bool isChrRam)
{
_console = console;
_saveFolder = saveFolder;
@ -27,6 +34,7 @@ HdPackBuilder::HdPackBuilder(shared_ptr<Console> console, string saveFolder, Sca
_chrRamBankSize = chrRamBankSize;
_flags = flags;
_isChrRam = isChrRam;
_outTileType = outTileType;
_hasNewTile = false;
_frameID = 0;
string existingPackDefinition = FolderUtilities::CombinePath(saveFolder, "hires.txt");
@ -211,7 +219,7 @@ void HdPackBuilder::AddTile(HdPackTileInfo *tile, uint32_t usageCount)
_hasNewTile = true;
}
void HdPackBuilder::ProcessTile(uint32_t x, uint32_t y, uint16_t tileAddr, HdPpuTileInfo &tile, BaseMapper *mapper, bool isSprite, uint32_t chrBankHash, bool transparencyRequired)
void HdPackBuilder::ProcessTile(uint32_t x, uint32_t y, uint16_t tileAddr, HdPpuTileInfo &tile, BaseMapper *mapper, uint32_t chrBankHash, bool transparencyRequired)
{
if(_flags & HdPackRecordFlags::IgnoreOverscan) {
OverscanDimensions overscan = _console->GetSettings()->GetOverscanDimensions();
@ -221,6 +229,14 @@ void HdPackBuilder::ProcessTile(uint32_t x, uint32_t y, uint16_t tileAddr, HdPpu
}
}
if(_outTileType == HDPackOuputTileType::BG && tile.IsSpriteTile()) {
return;
}
if (_outTileType == HDPackOuputTileType::Sprite && !tile.IsSpriteTile()) {
return;
}
auto result = _tileUsageCount.find(tile.GetKey(false));
if(result == _tileUsageCount.end()) {
//Check to see if a default tile matches

View file

@ -31,6 +31,7 @@ private:
string _saveFolder;
string _romName;
uint32_t _flags;
uint32_t _outTileType;
bool _hasNewTile;
uint32_t _frameID;
vector<HdScreenTileInfo> spritesOnScreen;
@ -46,11 +47,11 @@ private:
void DrawTile(HdPackTileInfo *tile, int tileIndex, uint32_t* pngBuffer, int pageNumber, bool containsSpritesOnly);
public:
HdPackBuilder(shared_ptr<Console> console, string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, bool isChrRam);
HdPackBuilder(shared_ptr<Console> console, string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, uint32_t outTileType, bool isChrRam);
~HdPackBuilder();
void endFrame();
void ProcessTile(uint32_t x, uint32_t y, uint16_t tileAddr, HdPpuTileInfo& tile, BaseMapper* mapper, bool isSprite, uint32_t chrBankHash, bool transparencyRequired);
void ProcessTile(uint32_t x, uint32_t y, uint16_t tileAddr, HdPpuTileInfo& tile, BaseMapper* mapper, uint32_t chrBankHash, bool transparencyRequired);
void SaveHdPack();
static void GetChrBankList(uint32_t *banks);

View file

@ -22,6 +22,7 @@ private:
uint8_t _prgMode;
bool _enablePrgAt6000;
uint8_t _prgBlock;
uint8_t _chrMode;
bool _chrBlockMode;
@ -71,6 +72,7 @@ protected:
_prgMode = 0;
_enablePrgAt6000 = false;
_prgBlock = 0;
_chrMode = 0;
_chrBlockMode = false;
@ -113,7 +115,7 @@ protected:
ArrayInfo<uint8_t> ntLowRegs{ _ntLowRegs, 4 };
ArrayInfo<uint8_t> ntHighRegs{ _ntHighRegs, 4 };
Stream(_chrLatch[0], _chrLatch[1], _prgMode, _enablePrgAt6000, _chrMode, _chrBlockMode, _chrBlock, _mirrorChr, _mirroringReg, _advancedNtControl,
Stream(_chrLatch[0], _chrLatch[1], _prgMode, _enablePrgAt6000, _prgBlock, _chrMode, _chrBlockMode, _chrBlock, _mirrorChr, _mirroringReg, _advancedNtControl,
_disableNtRam, _ntRamSelectBit, _irqEnabled, _irqSource, _lastPpuAddr, _irqCountDirection, _irqFunkyMode, _irqFunkyModeReg, _irqSmallPrescaler,
_irqPrescaler, _irqCounter, _irqXorReg, _multiplyValue1, _multiplyValue2, _regRamValue, prgRegs, chrLowRegs, chrHighRegs, ntLowRegs, ntHighRegs);
@ -132,7 +134,7 @@ protected:
uint8_t InvertPrgBits(uint8_t prgReg, bool needInvert)
{
if(needInvert) {
return (prgReg & 0x01) << 6 | (prgReg & 0x02) << 4 | (prgReg & 0x04) << 2 | (prgReg & 0x10) >> 2 | (prgReg & 0x20) >> 4 | (prgReg & 0x40) >> 6;
return (prgReg & 0x01) << 6 | (prgReg & 0x02) << 4 | (prgReg & 0x04) << 2 | (prgReg & 0x08) | (prgReg & 0x10) >> 2 | (prgReg & 0x20) >> 4 | (prgReg & 0x40) >> 6;
} else {
return prgReg;
}
@ -162,10 +164,10 @@ protected:
case 2:
case 3:
SelectPRGPage(0, prgRegs[0]);
SelectPRGPage(1, prgRegs[1]);
SelectPRGPage(2, prgRegs[2]);
SelectPRGPage(3, (_prgMode & 0x04) ? prgRegs[3] : 0x3F);
SelectPRGPage(0, prgRegs[0] | (_prgBlock << 5));
SelectPRGPage(1, prgRegs[1] | (_prgBlock << 5));
SelectPRGPage(2, prgRegs[2] | (_prgBlock << 5));
SelectPRGPage(3, (_prgMode & 0x04) ? prgRegs[3] | (_prgBlock << 5) : 0x3F);
if(_enablePrgAt6000) {
SetCpuMemoryMapping(0x6000, 0x7FFF, prgRegs[3], PrgMemoryType::PrgRom);
}
@ -332,6 +334,11 @@ protected:
_mirrorChr = (value & 0x80) == 0x80;
_chrBlockMode = (value & 0x20) == 0x00;
_chrBlock = ((value & 0x18) >> 2) | (value & 0x01);
if (_romInfo.MapperID == 35 || _romInfo.MapperID == 90 || _romInfo.MapperID == 209 || _romInfo.MapperID == 211) {
_prgBlock = value & 0x06;
}
break;
}

View file

@ -52,7 +52,7 @@ struct TraceLoggerOptions
class TraceLogger
{
private:
static constexpr int ExecutionLogSize = 30000;
static constexpr int ExecutionLogSize = 20000;
//Must be static to be thread-safe when switching game
static string _executionTrace;

View file

@ -625,6 +625,7 @@
<Control ID="chkGroupBlankTiles">Group blank tiles</Control>
<Control ID="chkIgnoreOverscan">Ignore tiles at the edges of the screen (overscan)</Control>
<Control ID="chkSaveFrame">Save frames which the tiles are first shown</Control>
<Control ID="chkTileType">Choose which tiles are recorded</Control>
<Control ID="lblFolder">Save Folder:</Control>
<Control ID="btnSelectFolder">Browse...</Control>
<Control ID="btnStartRecording">Start Recording</Control>
@ -868,9 +869,10 @@
<Message ID="HdPackBuilderBankSizeHelp">This option is only available for CHR RAM games. CHR RAM games have no&#xA;fixed "banks" - they are dynamically created by the game's code.&#xA;This option alters the HD Pack Builder's behavior when grouping the tiles into &#xA;the PNG files - a smaller bank size will usually result in less PNG &#xA;files (but depending on the game's code, larger values may produce &#xA;better results).</Message>
<Message ID="HdPackBuilderFrequencyHelp">When this option is enabled, the tiles in PNG files are sorted by the&#xA;frequency at which they are shown on the screen while recording (more &#xA;common palettes will be grouped together in the first PNG for a specific bank &#xA;number. If this option is unchecked, the PNGs will be sorted by palette - &#xA;each PNG will only contain up to 4 different colors in this case.</Message>
<Message ID="HdPackBuilderGroupBlankHelp">This option groups all the blank tiles sequentially into the same PNG&#xA;files - this helps reduce the number of PNG files produced by removing &#xA;almost-empty PNG files containing only blank tiles.</Message>
<Message ID="HdPackBuilderLargeSpritesHelp">When enabled, this option will alter the display order of CHR banks&#xA;that contain only sprites to make the sprites easier to edit in the PNG file.</Message>
<Message ID="HdPackBuilderLargeSpritesHelp">When enabled, this option will alter the display order of CHR banks&#xA;that contain only sprites to make the sprites easier to edit in the PNG file.&#xA;This should be used only when the game is a CHR-ROM game and uses 8x16 sprites.</Message>
<Message ID="HdPackBuilderIgnoreOverscanHelp">When enabled, this will make the builder ignore any pixels in the overscan area.&#xA;This is useful in games that contain glitches on the outer edge of the screen.&#xA;Incorrect palette combinations due to these glitches will be ignored and won't be shown in the PNG files.</Message>
<Message ID="HdPackBuilderSaveFrameHelp">When enabled, the builder will save a screenshot and the composition of the screen in the pack folder when it encounters new tile in a frame.&#xA;This is useful for checking where that tile is used.&#xA;These files are not needed in the pack and should be deleted when sharing the pack.</Message>
<Message ID="HdPackBuilderTileTypeHelp">Choose which of the tiles are recorded</Message>
<Message ID="InstallHdPackWrongRom">The selected HD Pack is not compatible with the currently running game and cannot be installed.</Message>
<Message ID="InstallHdPackError">An error occurred while trying to install the HD Pack: &#xA;&#xA;{0}</Message>
@ -1373,5 +1375,10 @@
<Value ID="GenericMulticart">Generic Multicart</Value>
<Value ID="SnesControllers">SNES Controllers</Value>
</Enum>
<Enum ID="HDPackOuputTileType">
<Value ID="Both">BG + Sprite</Value>
<Value ID="BG">BG Only</Value>
<Value ID="Sprite">Sprite Only</Value>
</Enum>
</Enums>
</Resources>

View file

@ -62,6 +62,10 @@
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.chkSaveFrame = new System.Windows.Forms.CheckBox();
this.picSaveFrameHelp = new System.Windows.Forms.PictureBox();
this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel();
this.cboTileType = new System.Windows.Forms.ComboBox();
this.picTileTypeHelp = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.btnSelectFolder = new System.Windows.Forms.Button();
this.txtSaveFolder = new System.Windows.Forms.TextBox();
@ -87,6 +91,8 @@
((System.ComponentModel.ISupportInitialize)(this.picScaleHelp)).BeginInit();
this.flowLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picSaveFrameHelp)).BeginInit();
this.flowLayoutPanel7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picTileTypeHelp)).BeginInit();
this.tableLayoutPanel4.SuspendLayout();
this.SuspendLayout();
//
@ -240,10 +246,12 @@
this.tableLayoutPanel2.Controls.Add(this.flpBankSize, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel6, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel2, 0, 7);
this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel7, 1, 8);
this.tableLayoutPanel2.Controls.Add(this.label1, 0, 8);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 18);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 9;
this.tableLayoutPanel2.RowCount = 10;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
@ -252,7 +260,8 @@
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 18F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 18F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(325, 265);
this.tableLayoutPanel2.TabIndex = 0;
//
@ -285,7 +294,7 @@
this.picIgnoreOverscanHelp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.picIgnoreOverscanHelp.Location = new System.Drawing.Point(256, 3);
this.picIgnoreOverscanHelp.Name = "picIgnoreOverscanHelp";
this.picIgnoreOverscanHelp.Size = new System.Drawing.Size(16, 15);
this.picIgnoreOverscanHelp.Size = new System.Drawing.Size(16, 16);
this.picIgnoreOverscanHelp.TabIndex = 18;
this.picIgnoreOverscanHelp.TabStop = false;
//
@ -340,7 +349,7 @@
this.picGroupBlankHelp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.picGroupBlankHelp.Location = new System.Drawing.Point(113, 3);
this.picGroupBlankHelp.Name = "picGroupBlankHelp";
this.picGroupBlankHelp.Size = new System.Drawing.Size(16, 15);
this.picGroupBlankHelp.Size = new System.Drawing.Size(16, 16);
this.picGroupBlankHelp.TabIndex = 12;
this.picGroupBlankHelp.TabStop = false;
//
@ -375,7 +384,7 @@
this.picFrequencyHelp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.picFrequencyHelp.Location = new System.Drawing.Point(175, 3);
this.picFrequencyHelp.Name = "picFrequencyHelp";
this.picFrequencyHelp.Size = new System.Drawing.Size(16, 15);
this.picFrequencyHelp.Size = new System.Drawing.Size(16, 16);
this.picFrequencyHelp.TabIndex = 12;
this.picFrequencyHelp.TabStop = false;
//
@ -408,7 +417,7 @@
this.picLargeSpritesHelp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.picLargeSpritesHelp.Location = new System.Drawing.Point(170, 3);
this.picLargeSpritesHelp.Name = "picLargeSpritesHelp";
this.picLargeSpritesHelp.Size = new System.Drawing.Size(16, 15);
this.picLargeSpritesHelp.Size = new System.Drawing.Size(16, 16);
this.picLargeSpritesHelp.TabIndex = 12;
this.picLargeSpritesHelp.TabStop = false;
//
@ -444,7 +453,7 @@
this.picBankSizeHelp.Location = new System.Drawing.Point(114, 6);
this.picBankSizeHelp.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.picBankSizeHelp.Name = "picBankSizeHelp";
this.picBankSizeHelp.Size = new System.Drawing.Size(16, 15);
this.picBankSizeHelp.Size = new System.Drawing.Size(16, 16);
this.picBankSizeHelp.TabIndex = 12;
this.picBankSizeHelp.TabStop = false;
//
@ -476,7 +485,7 @@
this.picScaleHelp.Location = new System.Drawing.Point(114, 6);
this.picScaleHelp.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.picScaleHelp.Name = "picScaleHelp";
this.picScaleHelp.Size = new System.Drawing.Size(16, 15);
this.picScaleHelp.Size = new System.Drawing.Size(16, 16);
this.picScaleHelp.TabIndex = 12;
this.picScaleHelp.TabStop = false;
//
@ -509,10 +518,52 @@
this.picSaveFrameHelp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.picSaveFrameHelp.Location = new System.Drawing.Point(229, 3);
this.picSaveFrameHelp.Name = "picSaveFrameHelp";
this.picSaveFrameHelp.Size = new System.Drawing.Size(16, 15);
this.picSaveFrameHelp.Size = new System.Drawing.Size(16, 16);
this.picSaveFrameHelp.TabIndex = 19;
this.picSaveFrameHelp.TabStop = false;
//
// flowLayoutPanel7
//
this.flowLayoutPanel7.Controls.Add(this.cboTileType);
this.flowLayoutPanel7.Controls.Add(this.picTileTypeHelp);
this.flowLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel7.Location = new System.Drawing.Point(88, 140);
this.flowLayoutPanel7.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel7.Name = "flowLayoutPanel7";
this.flowLayoutPanel7.Size = new System.Drawing.Size(237, 22);
this.flowLayoutPanel7.TabIndex = 22;
//
// cboTileType
//
this.cboTileType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboTileType.DropDownWidth = 105;
this.cboTileType.FormattingEnabled = true;
this.cboTileType.Location = new System.Drawing.Point(3, 3);
this.cboTileType.Name = "cboTileType";
this.cboTileType.Size = new System.Drawing.Size(105, 20);
this.cboTileType.TabIndex = 0;
//
// picTileTypeHelp
//
this.picTileTypeHelp.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.picTileTypeHelp.BackgroundImage = global::Mesen.GUI.Properties.Resources.Help;
this.picTileTypeHelp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.picTileTypeHelp.Location = new System.Drawing.Point(114, 5);
this.picTileTypeHelp.Name = "picTileTypeHelp";
this.picTileTypeHelp.Size = new System.Drawing.Size(16, 16);
this.picTileTypeHelp.TabIndex = 20;
this.picTileTypeHelp.TabStop = false;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 145);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 21;
this.label1.Text = "Tile Type:";
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 3;
@ -608,6 +659,8 @@
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picSaveFrameHelp)).EndInit();
this.flowLayoutPanel7.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picTileTypeHelp)).EndInit();
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
this.ResumeLayout(false);
@ -655,5 +708,9 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.CheckBox chkSaveFrame;
private System.Windows.Forms.PictureBox picSaveFrameHelp;
}
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel7;
private System.Windows.Forms.ComboBox cboTileType;
private System.Windows.Forms.PictureBox picTileTypeHelp;
private System.Windows.Forms.Label label1;
}
}

View file

@ -44,8 +44,14 @@ namespace Mesen.GUI.Forms.HdPackEditor
toolTip.SetToolTip(picLargeSpritesHelp, ResourceHelper.GetMessage("HdPackBuilderLargeSpritesHelp"));
toolTip.SetToolTip(picIgnoreOverscanHelp, ResourceHelper.GetMessage("HdPackBuilderIgnoreOverscanHelp"));
toolTip.SetToolTip(picSaveFrameHelp, ResourceHelper.GetMessage("HdPackBuilderSaveFrameHelp"));
toolTip.SetToolTip(picTileTypeHelp, ResourceHelper.GetMessage("HdPackBuilderTileTypeHelp"));
UpdateUI(false);
cboTileType.Items.Add(ResourceHelper.GetEnumText(HDPackOuputTileType.Both));
cboTileType.Items.Add(ResourceHelper.GetEnumText(HDPackOuputTileType.BG));
cboTileType.Items.Add(ResourceHelper.GetEnumText(HDPackOuputTileType.Sprite));
cboTileType.SelectedIndex = 0;
UpdateUI(false);
}
protected override void OnFormClosing(FormClosingEventArgs e)
@ -126,6 +132,7 @@ namespace Mesen.GUI.Forms.HdPackEditor
chkGroupBlankTiles.Enabled = !isRecording;
chkIgnoreOverscan.Enabled = !isRecording;
chkSaveFrame.Enabled = !isRecording;
cboTileType.Enabled = !isRecording;
cboChrBankSize.Enabled = !isRecording;
cboScale.Enabled = !isRecording;
@ -162,7 +169,8 @@ namespace Mesen.GUI.Forms.HdPackEditor
if(chkSaveFrame.Checked) {
flags |= HdPackRecordFlags.SaveFrame;
}
InteropEmu.HdBuilderStartRecording(txtSaveFolder.Text, ((FilterInfo)cboScale.SelectedItem).FilterType, ((FilterInfo)cboScale.SelectedItem).Scale, flags, (UInt32)Math.Pow(2, cboChrBankSize.SelectedIndex) * 0x400);
HDPackOuputTileType tileType = (HDPackOuputTileType)cboTileType.SelectedIndex;
InteropEmu.HdBuilderStartRecording(txtSaveFolder.Text, ((FilterInfo)cboScale.SelectedItem).FilterType, ((FilterInfo)cboScale.SelectedItem).Scale, flags, (UInt32)Math.Pow(2, cboChrBankSize.SelectedIndex) * 0x400, tileType);
tmrRefresh.Start();
UpdateUI(true);

View file

@ -678,7 +678,8 @@ namespace Mesen.GUI
ScaleFilterType filterType,
UInt32 scale,
HdPackRecordFlags flags,
UInt32 chrRamBankSize);
UInt32 chrRamBankSize,
HDPackOuputTileType tileType);
[DllImport(DLLPath)] public static extern void HdBuilderStopRecording();
@ -2356,6 +2357,13 @@ namespace Mesen.GUI
Prescale10x = 24,
}
public enum HDPackOuputTileType
{
Both = 0,
BG = 1,
Sprite= 2
}
public enum VideoResizeFilter
{
NearestNeighbor = 0,

View file

@ -769,7 +769,7 @@ namespace InteropEmu {
DllExport bool __stdcall IsHdPpu() { return _console->IsHdPpu(); }
DllExport void __stdcall HdBuilderStartRecording(char* saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize) { _console->StartRecordingHdPack(saveFolder, filterType, scale, flags, chrRamBankSize); }
DllExport void __stdcall HdBuilderStartRecording(char* saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize, uint32_t outTileType) { _console->StartRecordingHdPack(saveFolder, filterType, scale, flags, chrRamBankSize, outTileType); }
DllExport void __stdcall HdBuilderStopRecording() { _console->StopRecordingHdPack(); }
DllExport void __stdcall HdBuilderGetChrBankList(uint32_t* bankBuffer) { HdPackBuilder::GetChrBankList(bankBuffer); }