Compare commits

..

2 commits

Author SHA1 Message Date
a48920b451 fix: linker errors from mixing C (Utils.m) and C++ (Tweak.xm/JSI.mm) TUs
- Wrap Utils.h's declarations in extern "C" so Tweak.xm/JSI.mm link against
  the plain-C symbols Utils.m actually exports, instead of expecting
  C++-mangled names that don't exist (confirmed via CI: "Undefined symbols
  ... showErrorAlert(NSString*, NSString*)").
- Add -undefined dynamic_lookup (matching RainTweak's Makefile): JSI/Hermes
  symbols like jsi::JSError's typeinfo only exist in the host process's own
  compiled-in runtime once the tweak is actually loaded into Discord, not
  anywhere available to link against at build time.
2026-08-03 10:34:27 -04:00
b50102c53c fix: Sideloading.x failed to compile - %orig used as nested message receiver
[%orig mutableCopy] doesn't survive Logos' macro expansion cleanly (confirmed
by an actual Theos build on GitHub Actions: "error: expected identifier").
Split into two statements instead, matching how %orig is used everywhere
else in this file.
2026-08-03 10:31:03 -04:00
3 changed files with 17 additions and 2 deletions

View file

@ -1,9 +1,20 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// Utils.m is compiled as plain Objective-C (C linkage), but Tweak.xm/JSI.mm are Objective-C++.
// Without extern "C", the C++ TU expects a mangled `showErrorAlert(NSString*, NSString*)` symbol
// that Utils.m never emits, breaking the link (confirmed by an actual Theos build on CI).
#ifdef __cplusplus
extern "C" {
#endif
NSURL *getPyoncordDirectory(void);
UIColor *hexToUIColor(NSString *hex);
void showErrorAlert(NSString *title, NSString *message);
/** Detects the Hermes bytecode magic header ("Herm"), as opposed to plain-text JS. */
BOOL isHermesBytecode(NSData *data);
BOOL isHermesBytecode(NSData *data);
#ifdef __cplusplus
}
#endif

View file

@ -11,6 +11,9 @@ Revenge_FILES = $(wildcard Sources/*.x Sources/*.xm Sources/*.m Sources/*.mm Sou
Revenge_CFLAGS = -fobjc-arc -DPACKAGE_VERSION='@"$(THEOS_PACKAGE_BASE_VERSION)"' -I$(THEOS_PROJECT_DIR)/Headers
Revenge_CCFLAGS = -std=c++17 -Wno-c++11-narrowing -I$(THEOS_PROJECT_DIR)/Headers
Revenge_FRAMEWORKS = Foundation UIKit CoreGraphics CoreText CoreFoundation
# JSI types (e.g. jsi::JSError's typeinfo) only exist in the host process's own compiled-in
# Hermes/JSI runtime, not anywhere we can statically link against - resolve at load time instead.
Revenge_LDFLAGS = -undefined dynamic_lookup
RevengeResources_INSTALL_PATH = "/Library/Application\ Support/"
RevengeResources_RESOURCE_DIRS = Resources

View file

@ -47,7 +47,8 @@ static BOOL isSelfCall(void) {
- (NSDictionary *)infoDictionary {
if (!isSelfCall()) return %orig;
NSMutableDictionary *info = [%orig mutableCopy];
NSDictionary *origInfo = %orig;
NSMutableDictionary *info = [origInfo mutableCopy];
info[@"CFBundleIdentifier"] = DISCORD_BUNDLE_ID;
info[@"CFBundleDisplayName"] = DISCORD_NAME;
info[@"CFBundleName"] = DISCORD_NAME;