Skip to content

Commit

Permalink
Merge branch 'opa334:2.x' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
m1337v authored Jun 14, 2024
2 parents 5a62967 + cdded6d commit f60dedf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Application/Dopamine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,7 @@
"$(PROJECT_DIR)/Dopamine/Dependencies",
"$(PROJECT_DIR)/Dopamine/Resources",
);
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.opa334.Dopamine;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -2273,7 +2273,7 @@
"$(PROJECT_DIR)/Dopamine/Dependencies",
"$(PROJECT_DIR)/Dopamine/Resources",
);
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.opa334.Dopamine;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
2 changes: 1 addition & 1 deletion Application/Dopamine/Jailbreak/DOBootstrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#import <sys/stat.h>
#import "NSString+Version.h"

#define LIBKRW_DOPAMINE_BUNDLED_VERSION @"2.0.2"
#define LIBKRW_DOPAMINE_BUNDLED_VERSION @"2.0.3"
#define LIBROOT_DOPAMINE_BUNDLED_VERSION @"1.0.1"
#define BASEBIN_LINK_BUNDLED_VERSION @"1.0.0"

Expand Down
46 changes: 27 additions & 19 deletions Application/Dopamine/UI/DOUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ - (void)completeJailbreak
[self.logView didComplete];
}

- (void)startLogCapture
- (void)observeFileDescriptor:(int)fd withCallback:(void (^)(char *line))callbackBlock
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
int stdout_pipe[2];
Expand All @@ -263,33 +263,28 @@ - (void)startLogCapture
return;
}

dup2(STDOUT_FILENO, stdout_orig[1]);
dup2(fd, stdout_orig[1]);
close(stdout_orig[0]);

dup2(stdout_pipe[1], STDOUT_FILENO);
dup2(stdout_pipe[1], fd);
close(stdout_pipe[1]);

char buffer[1024];
char cur = 0;
char line[1024];
int line_index = 0;
ssize_t bytes_read;

while ((bytes_read = read(stdout_pipe[0], buffer, sizeof(buffer) - 1)) > 0) {
while ((bytes_read = read(stdout_pipe[0], &cur, sizeof(cur))) > 0) {
@autoreleasepool {
// Tee: Write back to the original standard output
write(stdout_orig[1], buffer, bytes_read);

buffer[bytes_read] = '\0'; // Null terminate to handle as string
for (int i = 0; i < bytes_read; ++i) {
if (buffer[i] == '\n') {
line[line_index] = '\0';
NSString *str = [NSString stringWithUTF8String:line];
[self sendLog:str debug:YES];
line_index = 0;
} else {
if (line_index < sizeof(line) - 1) {
line[line_index++] = buffer[i];
}
write(stdout_orig[1], &cur, bytes_read);

if (cur == '\n') {
line[line_index] = '\0';
callbackBlock(line);
line_index = 0;
} else {
if (line_index < sizeof(line) - 1) {
line[line_index++] = cur;
}
}
}
Expand All @@ -298,6 +293,19 @@ - (void)startLogCapture
});
}

- (void)startLogCapture
{
[self observeFileDescriptor:STDOUT_FILENO withCallback:^(char *line) {
NSString *str = [NSString stringWithUTF8String:line];
[self sendLog:str debug:YES];
}];

[self observeFileDescriptor:STDERR_FILENO withCallback:^(char *line) {
NSString *str = [NSString stringWithUTF8String:line];
[self sendLog:str debug:YES];
}];
}

- (NSString *)localizedStringForKey:(NSString*)key
{
NSString *candidate = NSLocalizedString(key, nil);
Expand Down
2 changes: 1 addition & 1 deletion BaseBin/_external/basebin/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.6
2.1.7
4 changes: 2 additions & 2 deletions Packages/libkrw-provider/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Name: libkrw Plug-in (Dopamine)
Author: opa334 <[email protected]>
Maintainer: opa334 <[email protected]>
Architecture: iphoneos-arm64
Version: 2.0.2
Version: 2.0.3
Provides: libkrw0-plugin
Depends: libiosexec1 (>= 1.3.1), libkrw0
Depends: libiosexec1 (>= 1.3.1)
Section: Libraries
Priority: standard
Homepage: https://github.com/opa334/Dopamine/tree/main/Packages/libkrw-provider
Expand Down

0 comments on commit f60dedf

Please sign in to comment.