Skip to content

Commit c408d67

Browse files
committed
WIP updating code to 0.14
1 parent 0b389da commit c408d67

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

Sdk.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ pub fn compileAppLibrary(
895895

896896
// exe.addIncludePath(include_dir);
897897

898-
exe.addLibraryPath(sdk.b.path(lib_dir));
898+
exe.addLibraryPath(.{ .cwd_relative = lib_dir });
899899

900900
// exe.addIncludePath(include_dir);
901901
// exe.addIncludePath(system_include_dir);

examples/egl/main.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub const AndroidApp = struct {
7474
/// Uninitialize the application.
7575
/// Don't forget to stop your background thread here!
7676
pub fn deinit(self: *Self) void {
77-
@atomicStore(bool, &self.running, false, .SeqCst);
77+
@atomicStore(bool, &self.running, false, .seq_cst);
7878
if (self.thread) |thread| {
7979
thread.join();
8080
self.thread = null;
@@ -413,7 +413,7 @@ pub const AndroidApp = struct {
413413
1.0, 1.0,
414414
};
415415

416-
while (@atomicLoad(bool, &self.running, .SeqCst)) {
416+
while (@atomicLoad(bool, &self.running, .seq_cst)) {
417417

418418
// Input process
419419
{
@@ -846,18 +846,18 @@ const Oscillator = struct {
846846
amplitude: f64 = 0.1,
847847

848848
fn setWaveOn(self: *@This(), isWaveOn: bool) void {
849-
@atomicStore(bool, &self.isWaveOn, isWaveOn, .SeqCst);
849+
@atomicStore(bool, &self.isWaveOn, isWaveOn, .seq_cst);
850850
}
851851

852852
fn setSampleRate(self: *@This(), sample_rate: i32) void {
853853
self.phaseIncrement = (std.math.tau * self.frequency) / @as(f64, @floatFromInt(sample_rate));
854854
}
855855

856856
fn renderf32(self: *@This(), audio_data: []f32) void {
857-
if (!@atomicLoad(bool, &self.isWaveOn, .SeqCst)) self.phase = 0;
857+
if (!@atomicLoad(bool, &self.isWaveOn, .seq_cst)) self.phase = 0;
858858

859859
for (audio_data) |*frame| {
860-
if (@atomicLoad(bool, &self.isWaveOn, .SeqCst)) {
860+
if (@atomicLoad(bool, &self.isWaveOn, .seq_cst)) {
861861
frame.* += @as(f32, @floatCast(std.math.sin(self.phase) * self.amplitude));
862862
self.phase += self.phaseIncrement;
863863
if (self.phase > std.math.tau) self.phase -= std.math.tau;
@@ -866,10 +866,10 @@ const Oscillator = struct {
866866
}
867867

868868
fn renderi16(self: *@This(), audio_data: []i16) void {
869-
if (!@atomicLoad(bool, &self.isWaveOn, .SeqCst)) self.phase = 0;
869+
if (!@atomicLoad(bool, &self.isWaveOn, .seq_cst)) self.phase = 0;
870870

871871
for (audio_data) |*frame| {
872-
if (@atomicLoad(bool, &self.isWaveOn, .SeqCst)) {
872+
if (@atomicLoad(bool, &self.isWaveOn, .seq_cst)) {
873873
frame.* +|= @as(i16, @intFromFloat(@as(f32, @floatCast(std.math.sin(self.phase) * self.amplitude)) * std.math.maxInt(i16)));
874874
self.phase += self.phaseIncrement;
875875
if (self.phase > std.math.tau) self.phase -= std.math.tau;

src/android-support.zig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ var recursive_panic = false;
101101
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
102102
var logger = LogWriter{ .log_level = android.ANDROID_LOG_ERROR };
103103

104-
if (@atomicLoad(bool, &recursive_panic, .SeqCst)) {
104+
if (@atomicLoad(bool, &recursive_panic, .seq_cst)) {
105105
logger.writer().print("RECURSIVE PANIC: {s}\n", .{message}) catch {};
106106
while (true) {
107107
std.time.sleep(std.time.ns_per_week);
108108
}
109109
}
110110

111-
@atomicStore(bool, &recursive_panic, true, .SeqCst);
111+
@atomicStore(bool, &recursive_panic, true, .seq_cst);
112112

113113
logger.writer().print("PANIC: {s}\n", .{message}) catch {};
114114

@@ -140,7 +140,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi
140140

141141
logger.writer().writeAll("<-- end of stack trace -->\n") catch {};
142142

143-
std.os.exit(1);
143+
std.process.exit(1);
144144
}
145145

146146
const LogWriter = struct {
@@ -231,9 +231,9 @@ fn makeNativeActivityGlue(comptime App: type) android.ANativeActivityCallbacks {
231231
if (activity.instance) |instance| {
232232
const result = @call(.auto, @field(App, func), .{@as(*App, @ptrCast(@alignCast(instance)))} ++ args);
233233
switch (@typeInfo(@TypeOf(result))) {
234-
.ErrorUnion => result catch |err| app_log.err("{s} returned error {s}", .{ func, @errorName(err) }),
235-
.Void => {},
236-
.ErrorSet => app_log.err("{s} returned error {s}", .{ func, @errorName(result) }),
234+
.error_union => result catch |err| app_log.err("{s} returned error {s}", .{ func, @errorName(err) }),
235+
.void => {},
236+
.error_set => app_log.err("{s} returned error {s}", .{ func, @errorName(result) }),
237237
else => @compileError("callback must return void!"),
238238
}
239239
}
@@ -329,7 +329,7 @@ fn makeNativeActivityGlue(comptime App: type) android.ANativeActivityCallbacks {
329329
};
330330
}
331331

332-
inline fn printSymbolInfoAt(st_index: usize, maybe_debug_info: ?*std.debug.DebugInfo, int_addr: usize) void {
332+
inline fn printSymbolInfoAt(st_index: usize, maybe_debug_info: ?*std.debug.SelfInfo, int_addr: usize) void {
333333
var symbol_name_buffer: [1024]u8 = undefined;
334334
var symbol_name: ?[]const u8 = null;
335335

@@ -346,9 +346,9 @@ inline fn printSymbolInfoAt(st_index: usize, maybe_debug_info: ?*std.debug.Debug
346346
&symbol_name_buffer,
347347
"{s} {s} {s}",
348348
.{
349-
symbol.symbol_name,
349+
symbol.name,
350350
symbol.compile_unit_name,
351-
fmtMaybeLineInfo(symbol.line_info),
351+
fmtMaybeLineInfo(symbol.source_location),
352352
},
353353
) catch symbol_name;
354354
} else |_| {}
@@ -362,7 +362,7 @@ inline fn printSymbolInfoAt(st_index: usize, maybe_debug_info: ?*std.debug.Debug
362362
});
363363
}
364364

365-
fn realFmtMaybeLineInfo(self: ?std.debug.LineInfo, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
365+
fn realFmtMaybeLineInfo(self: ?std.debug.SourceLocation, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
366366
_ = fmt;
367367
_ = options;
368368
if (self) |li| {
@@ -376,7 +376,7 @@ fn realFmtMaybeLineInfo(self: ?std.debug.LineInfo, comptime fmt: []const u8, opt
376376
}
377377
}
378378

379-
fn fmtMaybeLineInfo(li: ?std.debug.LineInfo) std.fmt.Formatter(realFmtMaybeLineInfo) {
379+
fn fmtMaybeLineInfo(li: ?std.debug.SourceLocation) std.fmt.Formatter(realFmtMaybeLineInfo) {
380380
return std.fmt.Formatter(realFmtMaybeLineInfo){
381381
.data = li,
382382
};

src/jni.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const android = @import("android-support.zig");
1010
pub const JNI = opaque {
1111
// Underlying implementation
1212
fn JniReturnType(comptime function: @TypeOf(.literal)) type {
13-
@setEvalBranchQuota(10_000);
14-
return @typeInfo(@typeInfo(std.meta.fieldInfo(android.JNINativeInterface, function).type).Pointer.child).Fn.return_type.?;
13+
@setEvalBranchQuota(100_000);
14+
return @typeInfo(@typeInfo(std.meta.fieldInfo(android.JNINativeInterface, function).type).pointer.child).@"fn".return_type.?;
1515
}
1616

1717
pub inline fn invokeJniNoException(jni: *JNI, comptime function: @TypeOf(.literal), args: anytype) JniReturnType(function) {

0 commit comments

Comments
 (0)