Fixed memory leak in spm package

This commit is contained in:
Selim Mustafaev 2023-09-30 17:56:48 +03:00
parent 2e7b1bb480
commit 44ea8baea8
5 changed files with 14 additions and 6 deletions

View File

@ -31,6 +31,8 @@
_system->setNewFrameCallback([frameBufferSize, self](auto frameBuffer) {
_runEmulation = NO;
CGImageRelease(_frame);
CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, (void*)frameBuffer, frameBufferSize, NULL);
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGImageRef image = CGImageCreate(nes::Ppu::SCREEN_WIDTH,
@ -42,7 +44,7 @@
kCGImageAlphaPremultipliedLast,
dataProvider,
NULL,
true,
false,
kCGRenderingIntentDefault);
CGDataProviderRelease(dataProvider);
CGColorSpaceRelease(colorspace);

View File

@ -15,4 +15,8 @@ namespace nes {
_data <<= 1;
return result;
}
}
void Controller::poll() {
}
}

View File

@ -25,7 +25,7 @@ namespace nes {
public:
Controller();
uint8_t read();
virtual void poll() = 0;
virtual void poll();
protected:
uint8_t _data;

View File

@ -51,9 +51,10 @@ namespace nes {
// All visible scanlines
if (_scanline >= -1 && _scanline < 240) {
if(_scanline == 0 && _column == 0) {
_column = 1;
}
// ???
//if(_scanline == 0 && _column == 0) {
// _column = 1;
//}
if (_scanline == -1 && _column == 1) {
_status.verticalBlank = 0;

View File

@ -23,6 +23,7 @@ namespace nes {
_cpu = std::make_unique<Cpu>(this);
_ppu = std::make_unique<Ppu>();
_dma = std::make_unique<Dma>(this, _ppu.get());
_controller1 = std::make_shared<Controller>();
}
void System::insertCartridge(const fs::path &path, std::optional<uint16_t> address) {