mirror of
https://github.com/felipecsl/6502Android.git
synced 2024-06-07 15:48:23 +00:00
41 lines
1.1 KiB
Kotlin
41 lines
1.1 KiB
Kotlin
|
package android.emu6502.nes
|
||
|
|
||
|
import java.util.*
|
||
|
|
||
|
data class Cartridge(
|
||
|
// @formatter:off
|
||
|
val pgr: ByteArray, // PRG-ROM banks
|
||
|
val chr: ByteArray, // CHR-ROM banks
|
||
|
val mapper: Byte, // mapper type
|
||
|
val mirror: Byte, // mirroring mode
|
||
|
val battery: Byte // battery present
|
||
|
// @formatter:on
|
||
|
) {
|
||
|
private val sram: ByteArray = ByteArray(0x2000) // Save RAM
|
||
|
|
||
|
override fun equals(other: Any?): Boolean {
|
||
|
if (this === other) return true
|
||
|
if (other?.javaClass != javaClass) return false
|
||
|
|
||
|
other as Cartridge
|
||
|
|
||
|
if (!Arrays.equals(pgr, other.pgr)) return false
|
||
|
if (!Arrays.equals(chr, other.chr)) return false
|
||
|
if (!Arrays.equals(sram, other.sram)) return false
|
||
|
if (mapper != other.mapper) return false
|
||
|
if (mirror != other.mirror) return false
|
||
|
if (battery != other.battery) return false
|
||
|
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
override fun hashCode(): Int {
|
||
|
var result = Arrays.hashCode(pgr)
|
||
|
result = 31 * result + Arrays.hashCode(chr)
|
||
|
result = 31 * result + Arrays.hashCode(sram)
|
||
|
result = 31 * result + mapper
|
||
|
result = 31 * result + mirror
|
||
|
result = 31 * result + battery
|
||
|
return result
|
||
|
}
|
||
|
}
|