UI: Added screenshot support
This commit is contained in:
parent
7d068963a4
commit
20aee963c9
6 changed files with 18 additions and 14 deletions
|
@ -26,7 +26,7 @@ shared_ptr<BaseCartridge> BaseCartridge::CreateCartridge(VirtualFile &romFile, V
|
|||
romFile.ReadFile(romData);
|
||||
|
||||
shared_ptr<BaseCartridge> cart(new BaseCartridge());
|
||||
cart->_romPath = romFile.GetFilePath();
|
||||
cart->_romPath = romFile;
|
||||
cart->_prgRomSize = (uint32_t)romData.size();
|
||||
cart->_prgRom = new uint8_t[cart->_prgRomSize];
|
||||
memcpy(cart->_prgRom, romData.data(), cart->_prgRomSize);
|
||||
|
@ -156,7 +156,7 @@ RomInfo BaseCartridge::GetRomInfo()
|
|||
{
|
||||
RomInfo info;
|
||||
info.Header = _cartInfo;
|
||||
info.RomPath = _romPath;
|
||||
info.RomFile = static_cast<VirtualFile>(_romPath);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "BaseVideoFilter.h"
|
||||
#include "MessageManager.h"
|
||||
#include "ScaleFilter.h"
|
||||
#include "EmuSettings.h"
|
||||
#include "../Utilities/PNGHelper.h"
|
||||
#include "../Utilities/FolderUtilities.h"
|
||||
#include "Console.h"
|
||||
|
@ -111,17 +113,19 @@ void BaseVideoFilter::TakeScreenshot(VideoFilterType filterType, string filename
|
|||
rotateFilter.reset(new RotateFilter(rotationAngle));
|
||||
pngBuffer = rotateFilter->ApplyFilter(pngBuffer, frameInfo.Width, frameInfo.Height);
|
||||
frameInfo = rotateFilter->GetFrameInfo(frameInfo);
|
||||
}
|
||||
}*/
|
||||
|
||||
shared_ptr<ScaleFilter> scaleFilter = ScaleFilter::GetScaleFilter(filterType);
|
||||
if(scaleFilter) {
|
||||
pngBuffer = scaleFilter->ApplyFilter(pngBuffer, frameInfo.Width, frameInfo.Height, _console->GetSettings()->GetPictureSettings().ScanlineIntensity);
|
||||
pngBuffer = scaleFilter->ApplyFilter(pngBuffer, frameInfo.Width, frameInfo.Height, _console->GetSettings()->GetVideoConfig().ScanlineIntensity);
|
||||
frameInfo = scaleFilter->GetFrameInfo(frameInfo);
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
/*
|
||||
VideoHud hud;
|
||||
hud.DrawHud(_console, pngBuffer, frameInfo, _console->GetSettings()->GetOverscanDimensions());
|
||||
*/
|
||||
*/
|
||||
if(!filename.empty()) {
|
||||
PNGHelper::WritePNG(filename, pngBuffer, frameInfo.Width, frameInfo.Height);
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "../Utilities/VirtualFile.h"
|
||||
|
||||
struct SnesCartInformation
|
||||
{
|
||||
|
@ -27,5 +28,5 @@ struct SnesCartInformation
|
|||
struct RomInfo
|
||||
{
|
||||
SnesCartInformation Header;
|
||||
string RomPath;
|
||||
VirtualFile RomFile;
|
||||
};
|
|
@ -42,7 +42,7 @@ Debugger::Debugger(shared_ptr<Console> console)
|
|||
_executionStopped = false;
|
||||
_breakRequestCount = 0;
|
||||
|
||||
string cdlFile = FolderUtilities::CombinePath(FolderUtilities::GetDebuggerFolder(), FolderUtilities::GetFilename(_console->GetCartridge()->GetRomInfo().RomPath, false) + ".cdl");
|
||||
string cdlFile = FolderUtilities::CombinePath(FolderUtilities::GetDebuggerFolder(), FolderUtilities::GetFilename(_console->GetCartridge()->GetRomInfo().RomFile.GetFileName(), false) + ".cdl");
|
||||
_codeDataLogger->LoadCdlFile(cdlFile);
|
||||
|
||||
//TODO: Thread safety
|
||||
|
@ -59,7 +59,7 @@ Debugger::Debugger(shared_ptr<Console> console)
|
|||
|
||||
Debugger::~Debugger()
|
||||
{
|
||||
string cdlFile = FolderUtilities::CombinePath(FolderUtilities::GetDebuggerFolder(), FolderUtilities::GetFilename(_console->GetCartridge()->GetRomInfo().RomPath, false) + ".cdl");
|
||||
string cdlFile = FolderUtilities::CombinePath(FolderUtilities::GetDebuggerFolder(), FolderUtilities::GetFilename(_console->GetCartridge()->GetRomInfo().RomFile.GetFileName(), false) + ".cdl");
|
||||
_codeDataLogger->SaveCdlFile(cdlFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ SaveStateManager::SaveStateManager(shared_ptr<Console> console)
|
|||
|
||||
string SaveStateManager::GetStateFilepath(int stateIndex)
|
||||
{
|
||||
string romPath = _console->GetRomInfo().RomPath;
|
||||
string romFile = _console->GetRomInfo().RomFile.GetFileName();
|
||||
string folder = FolderUtilities::GetSaveStateFolder();
|
||||
string filename = FolderUtilities::GetFilename(romPath, false) + "_" + std::to_string(stateIndex) + ".mst";
|
||||
string filename = FolderUtilities::GetFilename(romFile, false) + "_" + std::to_string(stateIndex) + ".mst";
|
||||
return FolderUtilities::CombinePath(folder, filename);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void SaveStateManager::GetSaveStateHeader(ostream &stream)
|
|||
stream.write(sha1Hash.c_str(), sha1Hash.size());
|
||||
|
||||
RomInfo romInfo = _console->GetCartridge()->GetRomInfo();
|
||||
string romName = FolderUtilities::GetFilename(romInfo.RomPath, true);
|
||||
string romName = FolderUtilities::GetFilename(romInfo.RomFile.GetFileName(), true);
|
||||
uint32_t nameLength = (uint32_t)romName.size();
|
||||
stream.write((char*)&nameLength, sizeof(uint32_t));
|
||||
stream.write(romName.c_str(), romName.size());
|
||||
|
|
|
@ -223,8 +223,7 @@ bool VideoDecoder::IsRunning()
|
|||
void VideoDecoder::TakeScreenshot()
|
||||
{
|
||||
if(_videoFilter) {
|
||||
//TODO
|
||||
//_videoFilter->TakeScreenshot(_console->GetRomPath().GetFileName(), _videoFilterType);
|
||||
_videoFilter->TakeScreenshot(_console->GetRomInfo().RomFile.GetFileName(), _videoFilterType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue