1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 01:32:55 +00:00

Started working out some of my retain cycles and general failures to release. Switched .mm filename so that Xcode will stop getting confused when I try to switch between implementation and interface files.

This commit is contained in:
Thomas Harte 2015-07-27 21:15:10 -04:00
parent 1cbebdafcc
commit 3c25ead1f3
9 changed files with 39 additions and 10 deletions

View File

@ -24,6 +24,11 @@ Machine::Machine()
reset(); reset();
} }
Machine::~Machine()
{
delete _crt;
}
void Machine::get_output_pixel(uint8_t *pixel, int offset) void Machine::get_output_pixel(uint8_t *pixel, int offset)
{ {
// get the playfield pixel // get the playfield pixel

View File

@ -20,6 +20,7 @@ class Machine: public CPU6502::Processor<Machine> {
public: public:
Machine(); Machine();
~Machine();
int perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value); int perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value);

View File

@ -7,7 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
4B14144E1B5883E500E04248 /* Atari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B14144B1B5883E500E04248 /* Atari2600.mm */; }; 4B14144E1B5883E500E04248 /* CSAtari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B14144B1B5883E500E04248 /* CSAtari2600.mm */; };
4B14144F1B5883E500E04248 /* CSCathodeRayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B14144D1B5883E500E04248 /* CSCathodeRayView.m */; }; 4B14144F1B5883E500E04248 /* CSCathodeRayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B14144D1B5883E500E04248 /* CSCathodeRayView.m */; };
4B1414511B5885DF00E04248 /* Atari2600.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6D7F921B58822000787C9A /* Atari2600.cpp */; }; 4B1414511B5885DF00E04248 /* Atari2600.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6D7F921B58822000787C9A /* Atari2600.cpp */; };
4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414571B58879D00E04248 /* CPU6502.cpp */; }; 4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414571B58879D00E04248 /* CPU6502.cpp */; };
@ -311,8 +311,8 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
4B14144A1B5883E500E04248 /* Atari2600.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atari2600.h; sourceTree = "<group>"; }; 4B14144A1B5883E500E04248 /* CSAtari2600.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAtari2600.h; sourceTree = "<group>"; };
4B14144B1B5883E500E04248 /* Atari2600.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Atari2600.mm; sourceTree = "<group>"; }; 4B14144B1B5883E500E04248 /* CSAtari2600.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSAtari2600.mm; sourceTree = "<group>"; };
4B14144C1B5883E500E04248 /* CSCathodeRayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSCathodeRayView.h; sourceTree = "<group>"; }; 4B14144C1B5883E500E04248 /* CSCathodeRayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSCathodeRayView.h; sourceTree = "<group>"; };
4B14144D1B5883E500E04248 /* CSCathodeRayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSCathodeRayView.m; sourceTree = "<group>"; }; 4B14144D1B5883E500E04248 /* CSCathodeRayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSCathodeRayView.m; sourceTree = "<group>"; };
4B1414501B58848C00E04248 /* ClockSignal-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ClockSignal-Bridging-Header.h"; sourceTree = "<group>"; }; 4B1414501B58848C00E04248 /* ClockSignal-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ClockSignal-Bridging-Header.h"; sourceTree = "<group>"; };
@ -968,8 +968,8 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4B1414501B58848C00E04248 /* ClockSignal-Bridging-Header.h */, 4B1414501B58848C00E04248 /* ClockSignal-Bridging-Header.h */,
4B14144A1B5883E500E04248 /* Atari2600.h */, 4B14144A1B5883E500E04248 /* CSAtari2600.h */,
4B14144B1B5883E500E04248 /* Atari2600.mm */, 4B14144B1B5883E500E04248 /* CSAtari2600.mm */,
4B14144C1B5883E500E04248 /* CSCathodeRayView.h */, 4B14144C1B5883E500E04248 /* CSCathodeRayView.h */,
4B14144D1B5883E500E04248 /* CSCathodeRayView.m */, 4B14144D1B5883E500E04248 /* CSCathodeRayView.m */,
4BB73ECF1B587A6700552FC2 /* Clock Signal.entitlements */, 4BB73ECF1B587A6700552FC2 /* Clock Signal.entitlements */,
@ -1432,7 +1432,7 @@
4B1414511B5885DF00E04248 /* Atari2600.cpp in Sources */, 4B1414511B5885DF00E04248 /* Atari2600.cpp in Sources */,
4B366DFC1B5C165A0026627B /* CRT.cpp in Sources */, 4B366DFC1B5C165A0026627B /* CRT.cpp in Sources */,
4BB73EA41B587A5100552FC2 /* Atari2600Document.swift in Sources */, 4BB73EA41B587A5100552FC2 /* Atari2600Document.swift in Sources */,
4B14144E1B5883E500E04248 /* Atari2600.mm in Sources */, 4B14144E1B5883E500E04248 /* CSAtari2600.mm in Sources */,
4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */, 4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */,
4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */, 4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */,
4B14144F1B5883E500E04248 /* CSCathodeRayView.m in Sources */, 4B14144F1B5883E500E04248 /* CSCathodeRayView.m in Sources */,

View File

@ -48,6 +48,11 @@ class Atari2600Document: NSDocument, CSCathodeRayViewDelegate {
atari2600!.setROM(data) atari2600!.setROM(data)
} }
override func close() {
super.close()
openGLView!.invalidate()
}
// MARK: CSOpenGLViewDelegate // MARK: CSOpenGLViewDelegate
private var lastCycleCount: Int64? private var lastCycleCount: Int64?

View File

@ -11,7 +11,7 @@
@interface CSAtari2600 : NSObject @interface CSAtari2600 : NSObject
@property (nonatomic, strong) CSCathodeRayView *view; @property (nonatomic, weak) CSCathodeRayView *view;
- (void)runForNumberOfCycles:(int)cycles; - (void)runForNumberOfCycles:(int)cycles;
- (void)setROM:(NSData *)rom; - (void)setROM:(NSData *)rom;

View File

@ -6,7 +6,7 @@
// Copyright © 2015 Thomas Harte. All rights reserved. // Copyright © 2015 Thomas Harte. All rights reserved.
// //
#import "Atari2600.h" #import "CSAtari2600.h"
#import "Atari2600.hpp" #import "Atari2600.hpp"
@interface CSAtari2600 (Callbacks) @interface CSAtari2600 (Callbacks)
@ -62,4 +62,8 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
return self; return self;
} }
- (void)dealloc {
NSLog(@"");
}
@end @end

View File

@ -21,4 +21,6 @@
@property (nonatomic, weak) id <CSCathodeRayViewDelegate> delegate; @property (nonatomic, weak) id <CSCathodeRayViewDelegate> delegate;
@property (nonatomic, assign, nullable) CRTFrame *crtFrame; @property (nonatomic, assign, nullable) CRTFrame *crtFrame;
- (void)invalidate;
@end @end

View File

@ -59,11 +59,23 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
[view.delegate openGLView:view didUpdateToTime:*now]; [view.delegate openGLView:view didUpdateToTime:*now];
return kCVReturnSuccess; return kCVReturnSuccess;
} }
- (void)invalidate
{
CVDisplayLinkStop(displayLink);
}
- (void)dealloc - (void)dealloc
{ {
// Release the display link // Release the display link
CVDisplayLinkRelease(displayLink); CVDisplayLinkRelease(displayLink);
// Release OpenGL buffers
[self.openGLContext makeCurrentContext];
glDeleteBuffers(1, &_arrayBuffer);
glDeleteVertexArrays(1, &_vertexArray);
glDeleteTextures(1, &_textureName);
glDeleteProgram(_shaderProgram);
} }
- (void)reshape - (void)reshape

View File

@ -2,5 +2,5 @@
// Use this file to import your target's public headers that you would like to expose to Swift. // Use this file to import your target's public headers that you would like to expose to Swift.
// //
#import "Atari2600.h" #import "CSAtari2600.h"
#import "CSCathodeRayView.h" #import "CSCathodeRayView.h"