Fixed memory leak in spm package
This commit is contained in:
parent
2e7b1bb480
commit
44ea8baea8
@ -31,6 +31,8 @@
|
|||||||
_system->setNewFrameCallback([frameBufferSize, self](auto frameBuffer) {
|
_system->setNewFrameCallback([frameBufferSize, self](auto frameBuffer) {
|
||||||
_runEmulation = NO;
|
_runEmulation = NO;
|
||||||
|
|
||||||
|
CGImageRelease(_frame);
|
||||||
|
|
||||||
CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, (void*)frameBuffer, frameBufferSize, NULL);
|
CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, (void*)frameBuffer, frameBufferSize, NULL);
|
||||||
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
|
||||||
CGImageRef image = CGImageCreate(nes::Ppu::SCREEN_WIDTH,
|
CGImageRef image = CGImageCreate(nes::Ppu::SCREEN_WIDTH,
|
||||||
@ -42,7 +44,7 @@
|
|||||||
kCGImageAlphaPremultipliedLast,
|
kCGImageAlphaPremultipliedLast,
|
||||||
dataProvider,
|
dataProvider,
|
||||||
NULL,
|
NULL,
|
||||||
true,
|
false,
|
||||||
kCGRenderingIntentDefault);
|
kCGRenderingIntentDefault);
|
||||||
CGDataProviderRelease(dataProvider);
|
CGDataProviderRelease(dataProvider);
|
||||||
CGColorSpaceRelease(colorspace);
|
CGColorSpaceRelease(colorspace);
|
||||||
|
|||||||
@ -15,4 +15,8 @@ namespace nes {
|
|||||||
_data <<= 1;
|
_data <<= 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::poll() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ namespace nes {
|
|||||||
public:
|
public:
|
||||||
Controller();
|
Controller();
|
||||||
uint8_t read();
|
uint8_t read();
|
||||||
virtual void poll() = 0;
|
virtual void poll();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t _data;
|
uint8_t _data;
|
||||||
|
|||||||
@ -51,9 +51,10 @@ namespace nes {
|
|||||||
// All visible scanlines
|
// All visible scanlines
|
||||||
if (_scanline >= -1 && _scanline < 240) {
|
if (_scanline >= -1 && _scanline < 240) {
|
||||||
|
|
||||||
if(_scanline == 0 && _column == 0) {
|
// ???
|
||||||
_column = 1;
|
//if(_scanline == 0 && _column == 0) {
|
||||||
}
|
// _column = 1;
|
||||||
|
//}
|
||||||
|
|
||||||
if (_scanline == -1 && _column == 1) {
|
if (_scanline == -1 && _column == 1) {
|
||||||
_status.verticalBlank = 0;
|
_status.verticalBlank = 0;
|
||||||
|
|||||||
@ -23,6 +23,7 @@ namespace nes {
|
|||||||
_cpu = std::make_unique<Cpu>(this);
|
_cpu = std::make_unique<Cpu>(this);
|
||||||
_ppu = std::make_unique<Ppu>();
|
_ppu = std::make_unique<Ppu>();
|
||||||
_dma = std::make_unique<Dma>(this, _ppu.get());
|
_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) {
|
void System::insertCartridge(const fs::path &path, std::optional<uint16_t> address) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user