Skip to content

Commit c3586ef

Browse files
committed
Fixed a bug causing closed ROMs to run in background
1 parent 939dd6a commit c3586ef

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Cocoa/Document.m

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@
1717
#import "GBHexStatusBarRepresenter.h"
1818
#import "NSObject+DefaultsObserver.h"
1919

20+
void *AllocationAt(uintptr_t x)
21+
{
22+
size_t malloc_size(const void *ptr);
23+
uintptr_t t = x & ~7;
24+
for (unsigned i = 0; i < 128; i++) {
25+
size_t size = malloc_size((void *)t);
26+
if (!size) {
27+
t -= 8;
28+
continue;
29+
}
30+
if (x < t + size) {
31+
return (void *)t;
32+
}
33+
return NULL;
34+
}
35+
return NULL;
36+
}
37+
2038
#define likely(x) GB_likely(x)
2139
#define unlikely(x) GB_unlikely(x)
2240

@@ -348,7 +366,7 @@ - (void)initCommon
348366
}];
349367

350368
[self observeStandardDefaultsKey:@"GBTurboCap" withBlock:^(NSNumber *value) {
351-
if (!_master) {
369+
if (!weakSelf->_master) {
352370
GB_set_turbo_cap(gb, value.doubleValue);
353371
}
354372
}];

0 commit comments

Comments
 (0)