custom bundle id

This commit is contained in:
Stephen 2025-03-27 06:42:11 -04:00
parent 80493a1393
commit 4011468e6a
3 changed files with 34 additions and 9 deletions

View file

@ -8,19 +8,39 @@
import SwiftUI
struct HomeView: View {
@AppStorage("bundleID") var bundleID: String = "com.stossy11.MeloNX"
var body: some View {
Button(action: startJITInBackground) {
Text("Enable Jit")
VStack(spacing: 20) {
TextField("Enter Bundle ID", text: $bundleID)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
Button(action: startJITInBackground) {
Text("Enable Jit")
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
}
.padding()
}
func startJITInBackground() {
DispatchQueue.global(qos: .background).async {
jitMain()
guard let cBundleID = strdup(bundleID) else {
return
}
var args: [UnsafeMutablePointer<Int8>?] = [cBundleID]
let argc = Int32(args.count)
args.withUnsafeMutableBufferPointer { buffer in
_ = jitMain(argc, buffer.baseAddress)
}
free(cBundleID)
}
}
}

View file

@ -21,8 +21,13 @@ int jitMain(int argc, char **argv) {
// Initialize logger
idevice_init_logger(Debug, Disabled, NULL);
// Hardcode bundle identifier and device IP
const char *bundle_id = "com.stossy11.MeloNX";
if (argc < 1) {
fprintf(stderr, "Usage: <bundle_id>\n");
return 1;
}
const char *bundle_id = argv[0];
// Hardcode device IP
const char *device_ip = "10.7.0.1";
/*****************************************************************

View file

@ -9,6 +9,6 @@
#ifndef JIT_H
#define JIT_H
void jitMain();
int jitMain(int argc, char **argv);
#endif /* JIT_H */