summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/snes
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2017-04-09 13:06:11 -0400
committer Vas Crabb <cuavas@users.noreply.github.com>2017-04-10 14:13:42 +1000
commit2724e695263500e92aeb98edb88b17201b4000bd (patch)
treec046c01134bfd95f99e63336c4c9646e69adc89e /src/devices/bus/snes
parentabedbd9c68a5031fa1636eb5147c086d3a888d45 (diff)
Made a number of methods be const correct and static where appropriate
Also changed a few methods to return 'bool' when appropriate
Diffstat (limited to 'src/devices/bus/snes')
-rw-r--r--src/devices/bus/snes/snes_slot.cpp12
-rw-r--r--src/devices/bus/snes/snes_slot.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp
index 3fc6ee6459a..a6caac6ba01 100644
--- a/src/devices/bus/snes/snes_slot.cpp
+++ b/src/devices/bus/snes/snes_slot.cpp
@@ -308,7 +308,7 @@ static const char *sns_get_slot(int type)
/* Here we add a couple of cart utilities, to avoid duplicating the code in each DEVICE_IMAGE_LOAD */
-uint32_t base_sns_cart_slot_device::snes_skip_header( uint8_t *ROM, uint32_t rom_size )
+uint32_t base_sns_cart_slot_device::snes_skip_header(const uint8_t *ROM, uint32_t rom_size) const
{
uint8_t header[512];
uint32_t offset = 512;
@@ -345,7 +345,7 @@ uint32_t base_sns_cart_slot_device::snes_skip_header( uint8_t *ROM, uint32_t rom
/* This function assign a 'score' to data immediately after 'offset' to measure how valid they are
as information block (to decide if the image is HiRom, LoRom, ExLoRom or ExHiRom) */
/* Code from bsnes, courtesy of byuu - http://byuu.org/ , based on previous code by Cowering */
-static int snes_validate_infoblock( uint8_t *infoblock, uint32_t offset )
+static int snes_validate_infoblock(const uint8_t *infoblock, uint32_t offset)
{
int score = 0;
uint16_t reset_vector = infoblock[offset + 0x3c] | (infoblock[offset + 0x3d] << 8);
@@ -454,7 +454,7 @@ static int snes_validate_infoblock( uint8_t *infoblock, uint32_t offset )
/* This determines if a cart is in Mode 20, 21, 22 or 25; sets state->m_cart[0].mode and
state->m_cart[0].sram accordingly; and returns the offset of the internal header (needed to
detect BSX and ST carts) */
-static uint32_t snes_find_hilo_mode(device_t *device, uint8_t *buffer, uint32_t buf_len )
+static uint32_t snes_find_hilo_mode(const device_t *device, const uint8_t *buffer, uint32_t buf_len)
{
uint8_t valid_mode20 = 0;
uint8_t valid_mode21 = 0;
@@ -490,7 +490,7 @@ static uint32_t snes_find_hilo_mode(device_t *device, uint8_t *buffer, uint32_t
}
-static int snes_find_addon_chip( uint8_t *buffer, uint32_t start_offs )
+static int snes_find_addon_chip( const uint8_t *buffer, uint32_t start_offs )
{
/* Info mostly taken from http://snesemu.black-ship.net/misc/hardware/-from%20nsrt.edgeemu.com-chipinfo.htm */
switch (buffer[start_offs + 0x16])
@@ -868,10 +868,10 @@ void base_sns_cart_slot_device::setup_nvram()
-void base_sns_cart_slot_device::get_cart_type_addon(uint8_t *ROM, uint32_t len, int &type, int &addon)
+void base_sns_cart_slot_device::get_cart_type_addon(const uint8_t *ROM, uint32_t len, int &type, int &addon) const
{
// First, look if the cart is HiROM or LoROM (and set snes_cart accordingly)
- int hilo_mode = snes_find_hilo_mode(this,ROM, len);
+ int hilo_mode = snes_find_hilo_mode(this, ROM, len);
switch (hilo_mode)
{
diff --git a/src/devices/bus/snes/snes_slot.h b/src/devices/bus/snes/snes_slot.h
index 641619a0262..941702eb97d 100644
--- a/src/devices/bus/snes/snes_slot.h
+++ b/src/devices/bus/snes/snes_slot.h
@@ -163,8 +163,8 @@ public:
virtual void call_unload() override;
virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
- void get_cart_type_addon(uint8_t *ROM, uint32_t len, int &type, int &addon);
- uint32_t snes_skip_header(uint8_t *ROM, uint32_t snes_rom_size);
+ void get_cart_type_addon(const uint8_t *ROM, uint32_t len, int &type, int &addon) const;
+ uint32_t snes_skip_header(const uint8_t *ROM, uint32_t snes_rom_size) const;
int get_type() { return m_type; }
void setup_nvram();