mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2025-02-21 10:53:09 +00:00

* GB: integrated SameBoy v0.12.1 by Lior Halphon * SFC: added HG51B169 (Cx4) math tables into bsnes binary
70 lines
1.2 KiB
C++
Executable File
70 lines
1.2 KiB
C++
Executable File
#if defined(Hiro_Timer)
|
|
|
|
@implementation CocoaTimer : NSObject
|
|
|
|
-(id) initWith:(hiro::mTimer&)timerReference {
|
|
if(self = [super init]) {
|
|
timer = &timerReference;
|
|
instance = nil;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
-(NSTimer*) instance {
|
|
return instance;
|
|
}
|
|
|
|
-(void) update {
|
|
if(instance) {
|
|
[instance invalidate];
|
|
instance = nil;
|
|
}
|
|
if(timer->enabled()) {
|
|
instance = [NSTimer
|
|
scheduledTimerWithTimeInterval:timer->state.interval / 1000.0
|
|
target:self selector:@selector(run:) userInfo:nil repeats:YES
|
|
];
|
|
}
|
|
}
|
|
|
|
-(void) run:(NSTimer*)instance {
|
|
if(hiro::Application::state().quit) return;
|
|
|
|
if(timer->enabled()) {
|
|
timer->doActivate();
|
|
}
|
|
}
|
|
|
|
@end
|
|
|
|
namespace hiro {
|
|
|
|
auto pTimer::construct() -> void {
|
|
@autoreleasepool {
|
|
cocoaTimer = [[CocoaTimer alloc] initWith:self()];
|
|
}
|
|
}
|
|
|
|
auto pTimer::destruct() -> void {
|
|
@autoreleasepool {
|
|
if([cocoaTimer instance]) [[cocoaTimer instance] invalidate];
|
|
[cocoaTimer release];
|
|
}
|
|
}
|
|
|
|
auto pTimer::setEnabled(bool enabled) -> void {
|
|
@autoreleasepool {
|
|
[cocoaTimer update];
|
|
}
|
|
}
|
|
|
|
auto pTimer::setInterval(uint interval) -> void {
|
|
@autoreleasepool {
|
|
[cocoaTimer update];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|