mirror of
https://github.com/Smallhacker/disbrowser.git
synced 2024-11-24 03:34:50 +00:00
Added updating synchronization
This commit is contained in:
parent
32b19c2c47
commit
1e8fbe1b0d
@ -8,6 +8,7 @@ import com.smallhacker.disbrowser.util.toUInt24
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
||||
private val RESET_VECTOR_LOCATION = address(0x00_FFFC)
|
||||
private val UPDATE_MUTEX = Any()
|
||||
|
||||
private val VECTORS = listOf(
|
||||
address(0x00_FFE4) to "COP",
|
||||
@ -60,12 +61,14 @@ object Service {
|
||||
}
|
||||
|
||||
fun updateMetadata(game: Game, address: SnesAddress, field: KMutableProperty1<MetadataLine, String?>, value: String) {
|
||||
if (value.isEmpty()) {
|
||||
if (address in game.gameData) {
|
||||
doUpdateMetadata(game, address, field, null)
|
||||
synchronized(UPDATE_MUTEX) {
|
||||
if (value.isEmpty()) {
|
||||
if (address in game.gameData) {
|
||||
doUpdateMetadata(game, address, field, null)
|
||||
}
|
||||
} else {
|
||||
doUpdateMetadata(game, address, field, value)
|
||||
}
|
||||
} else {
|
||||
doUpdateMetadata(game, address, field, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user