Skip to content

Commit

Permalink
fix header reading
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Oct 21, 2024
1 parent 6d0759c commit 0291f9a
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import io.rebble.libpebblecommon.util.DataBuffer
import okio.buffer
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import kotlin.random.Random
import kotlin.random.nextUInt

class PbwApp(uri: String): KoinComponent {
private val platformContext: PlatformContext by inject()
Expand All @@ -35,7 +37,7 @@ class PbwApp(uri: String): KoinComponent {
val exists = lockerDao.getEntryByUuid(info.uuid)
lockerDao.insertOrReplace(
SyncedLockerEntry(
id = exists?.entry?.id ?: "",
id = exists?.entry?.id ?: "local-${Random.nextUInt()}",
uuid = info.uuid,
version = info.versionLabel,
title = info.shortName,
Expand Down Expand Up @@ -66,12 +68,11 @@ class PbwApp(uri: String): KoinComponent {
val platforms = WatchType.entries.mapNotNull {
val manifest = getPbwManifest(file, it)
if (manifest != null) {
val header = PbwBinHeader().apply {
fromBytes(DataBuffer(requirePbwBinaryBlob(file, it, "pebble-app.bin")
.buffer()
.readByteArray((PbwBinHeader.SIZE+1).toLong()).asUByteArray()
))
}
val header = PbwBinHeader.parseFileHeader(
requirePbwBinaryBlob(file, it, "pebble-app.bin")
.buffer()
.readByteArray((PbwBinHeader.SIZE).toLong()).asUByteArray()
)

SyncedLockerEntryPlatform(
platformEntryId = 0,
Expand Down

0 comments on commit 0291f9a

Please sign in to comment.