1. Merge branch 'master' into diimage_filetype_as_stdstring

2.  Introduced is_filetype(), instead of normalizing filetype() to lower case
This commit is contained in:
Nathan Woods 2016-07-31 23:52:57 -04:00
commit 59ca4d1763
64 changed files with 475 additions and 314 deletions

View File

@ -378,7 +378,7 @@ bool a78_cart_slot_device::call_load()
char head[128];
fread(head, 128);
if (verify_header((char *)head) == IMAGE_VERIFY_FAIL)
if (!verify_header((char *)head))
return IMAGE_INIT_FAIL;
len = (head[49] << 24) | (head[50] << 16) | (head[51] << 8) | head[52];
@ -499,18 +499,18 @@ void a78_cart_slot_device::call_unload()
has an admissible header
-------------------------------------------------*/
int a78_cart_slot_device::verify_header(char *header)
bool a78_cart_slot_device::verify_header(char *header)
{
const char *magic = "ATARI7800";
if (strncmp(magic, header + 1, 9))
{
logerror("Not a valid A7800 image\n");
return IMAGE_VERIFY_FAIL;
return false;
}
logerror("returning ID_OK\n");
return IMAGE_VERIFY_PASS;
return true;
}

View File

@ -128,7 +128,7 @@ private:
device_a78_cart_interface* m_cart;
int m_type;
int verify_header(char *header);
bool verify_header(char *header);
int validate_header(int head, bool log);
void internal_header_logging(UINT8 *header, UINT32 len);
};

View File

@ -189,6 +189,15 @@ ioport_constructor apricot_keyboard_hle_device::device_input_ports() const
return INPUT_PORTS_NAME( keyboard );
}
static MACHINE_CONFIG_FRAGMENT( keyboard_components )
MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz)
MACHINE_CONFIG_END
machine_config_constructor apricot_keyboard_hle_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( keyboard_components );
}
//**************************************************************************
// LIVE DEVICE
@ -202,7 +211,9 @@ apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &m
device_t(mconfig, APRICOT_KEYBOARD_HLE, "Apricot Keyboard (HLE)", tag, owner, clock, "apricotkb_hle", __FILE__),
device_apricot_keyboard_interface(mconfig, *this),
device_buffered_serial_interface(mconfig, *this),
device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c")
device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c"),
m_rtc(*this, "rtc"),
m_rtc_index(0)
{
}
@ -234,19 +245,72 @@ void apricot_keyboard_hle_device::device_reset()
start_processing(attotime::from_hz(7800));
}
//-------------------------------------------------
// tra_callback - send bit to host
//-------------------------------------------------
void apricot_keyboard_hle_device::tra_callback()
{
m_host->in_w(transmit_register_get_data_bit());
}
void apricot_keyboard_hle_device::tra_complete()
{
device_buffered_serial_interface::tra_complete();
}
//-------------------------------------------------
// received_byte - handle received byte
//-------------------------------------------------
void apricot_keyboard_hle_device::received_byte(UINT8 byte)
{
logerror("received command: %02x\n", byte);
if ((byte & 0xf0) == 0xf0)
{
// rtc data
if (m_rtc_index >= 0)
{
m_rtc->address_w(m_rtc_index--);
m_rtc->data_w(machine().driver_data()->generic_space(), 0, byte);
}
}
else
{
switch (byte)
{
case CMD_REQ_TIME_AND_DATE:
logerror("System requests current time\n");
// remove pending keys just in case
clear_fifo();
// send time prefix
transmit_byte(0xed);
// make rtc chip ready
m_rtc->cs_w(1);
m_rtc->read_w(1);
// send bcd encoded date and time to system
for (int i = 12; i >= 0; i--)
{
m_rtc->address_w(i);
transmit_byte(0xf0 | m_rtc->data_r(machine().driver_data()->generic_space(), 0));
}
break;
case CMD_SET_TIME_AND_DATE:
logerror("System requests to set time\n");
// we start with the year
m_rtc_index = 12;
// make rtc chip ready
m_rtc->cs_w(1);
m_rtc->write_w(1);
break;
default:
logerror("Unhandled command: %02x\n", byte);
}
}
}
//-------------------------------------------------
@ -269,20 +333,15 @@ void apricot_keyboard_hle_device::key_break(UINT8 row, UINT8 column)
transmit_byte(0x80 | (row << 3) | column);
}
//-------------------------------------------------
// out_w - receive bit from host
//-------------------------------------------------
void apricot_keyboard_hle_device::out_w(int state)
{
device_buffered_serial_interface::rx_w(state);
}
//-------------------------------------------------
// transmit_byte - send a byte or queue it
//-------------------------------------------------
void apricot_keyboard_hle_device::transmit_byte(UINT8 byte)
{
device_buffered_serial_interface::transmit_byte(byte);
}
//-------------------------------------------------
// device_timer - device-specific timer
//-------------------------------------------------

View File

@ -14,6 +14,7 @@
#include "emu.h"
#include "keyboard.h"
#include "machine/keyboard.h"
#include "machine/msm5832.h"
//**************************************************************************
@ -24,7 +25,7 @@
class apricot_keyboard_hle_device : public device_t,
public device_apricot_keyboard_interface,
public device_buffered_serial_interface<8>,
public device_buffered_serial_interface<16>,
protected device_matrix_keyboard_interface<13>
{
public:
@ -37,22 +38,29 @@ public:
protected:
// device_t overrides
virtual ioport_constructor device_input_ports() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_start() override;
virtual void device_reset() override;
// device_buffered_serial_interface overrides
virtual void tra_callback() override;
virtual void tra_complete() override;
virtual void received_byte(UINT8 byte) override;
// device_matrix_keyboard_interface overrides
virtual void key_make(UINT8 row, UINT8 column) override;
virtual void key_break(UINT8 row, UINT8 column) override;
void transmit_byte(UINT8 byte);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
required_device<msm5832_device> m_rtc;
enum {
CMD_REQ_TIME_AND_DATE = 0xe1,
CMD_SET_TIME_AND_DATE = 0xe4
};
int m_rtc_index;
};

View File

@ -123,7 +123,7 @@ bool c64_expansion_slot_device::call_load()
{
size = length();
if (filetype() == "80")
if (is_filetype("80"))
{
fread(m_card->m_roml, size);
m_card->m_exrom = (0);
@ -133,20 +133,20 @@ bool c64_expansion_slot_device::call_load()
m_card->m_game = 0;
}
}
else if (filetype() == "a0")
else if (is_filetype("a0"))
{
fread(m_card->m_romh, 0x2000);
m_card->m_exrom = 0;
m_card->m_game = 0;
}
else if (filetype() == "e0")
else if (is_filetype("e0"))
{
fread(m_card->m_romh, 0x2000);
m_card->m_game = 0;
}
else if (filetype() == "crt")
else if (is_filetype("crt"))
{
size_t roml_size = 0;
size_t romh_size = 0;

View File

@ -111,17 +111,17 @@ bool cbm2_expansion_slot_device::call_load()
{
size = length();
if (filetype() == "20")
if (is_filetype("20"))
{
m_card->m_bank1.allocate(size);
fread(m_card->m_bank1, size);
}
else if (filetype() == "40")
else if (is_filetype("40"))
{
m_card->m_bank2.allocate(size);
fread(m_card->m_bank2, size);
}
else if (filetype() == "60")
else if (is_filetype("60"))
{
m_card->m_bank3.allocate(size);
fread(m_card->m_bank3, size);

View File

@ -249,7 +249,7 @@ int intv_cart_slot_device::load_fullpath()
UINT8 *ROM;
/* if it is in .rom format, we enter here */
if (filetype() == "rom")
if (is_filetype("rom"))
{
// header
fread(&temp, 1);

View File

@ -213,15 +213,15 @@ static const char *sega8_get_slot(int type)
call load
-------------------------------------------------*/
int sega8_cart_slot_device::verify_cart( UINT8 *magic, int size )
bool sega8_cart_slot_device::verify_cart( UINT8 *magic, int size )
{
int retval = IMAGE_VERIFY_FAIL;
int retval = false;
// Verify the file is a valid image - check $7ff0 for "TMR SEGA"
if (size >= 0x8000)
{
if (!strncmp((char*)&magic[0x7ff0], "TMR SEGA", 8))
retval = IMAGE_VERIFY_PASS;
retval = true;
}
return retval;
@ -368,7 +368,7 @@ bool sega8_cart_slot_device::call_load()
memcpy(ROM, get_software_region("rom"), get_software_region_length("rom"));
/* check the image */
if (verify_cart(ROM, len) == IMAGE_VERIFY_FAIL)
if (!verify_cart(ROM, len))
logerror("Warning loading image: verify_cart failed\n");
if (software_entry() != nullptr)

View File

@ -117,7 +117,7 @@ public:
void setup_ram();
void internal_header_logging(UINT8 *ROM, UINT32 len, UINT32 nvram_len);
int verify_cart(UINT8 *magic, int size);
bool verify_cart(UINT8 *magic, int size);
void set_lphaser_xoffset(UINT8 *rom, int size);
void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }

View File

@ -119,7 +119,7 @@ bool vic10_expansion_slot_device::call_load()
{
size = length();
if (filetype() == "80")
if (is_filetype("80"))
{
fread(m_card->m_lorom, 0x2000);
@ -128,11 +128,11 @@ bool vic10_expansion_slot_device::call_load()
fread(m_card->m_uprom, 0x2000);
}
}
else if (filetype() == "e0")
else if (is_filetype("e0"))
{
fread(m_card->m_uprom, size);
}
else if (filetype() == "crt")
else if (is_filetype("crt"))
{
size_t roml_size = 0;
size_t romh_size = 0;
@ -174,7 +174,7 @@ std::string vic10_expansion_slot_device::get_default_card_software()
{
if (open_image_file(mconfig().options()))
{
if (filetype() == "crt")
if (is_filetype("crt"))
return cbm_crt_get_card(*m_file);
clear();

View File

@ -113,13 +113,13 @@ bool vic20_expansion_slot_device::call_load()
{
if (software_entry() == nullptr)
{
if (filetype() == "20") fread(m_card->m_blk1, 0x2000);
else if (filetype() == "40") fread(m_card->m_blk2, 0x2000);
else if (filetype() == "60") fread(m_card->m_blk3, 0x2000);
else if (filetype() == "70") fread(m_card->m_blk3, 0x2000, 0x1000);
else if (filetype() == "a0") fread(m_card->m_blk5, 0x2000);
else if (filetype() == "b0") fread(m_card->m_blk5, 0x2000, 0x1000);
else if (filetype() == "crt")
if (is_filetype("20")) fread(m_card->m_blk1, 0x2000);
else if (is_filetype("40")) fread(m_card->m_blk2, 0x2000);
else if (is_filetype("60")) fread(m_card->m_blk3, 0x2000);
else if (is_filetype("70")) fread(m_card->m_blk3, 0x2000, 0x1000);
else if (is_filetype("a0")) fread(m_card->m_blk5, 0x2000);
else if (is_filetype("b0")) fread(m_card->m_blk5, 0x2000, 0x1000);
else if (is_filetype("crt"))
{
// read the header
UINT8 header[2];

View File

@ -73,10 +73,10 @@ void cassette_image_device::device_config_complete()
bool cassette_image_device::is_motor_on()
{
if ((m_state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED)
return FALSE;
return false;
if ((m_state & CASSETTE_MASK_MOTOR) != CASSETTE_MOTOR_ENABLED)
return FALSE;
return TRUE;
return false;
return true;
}

View File

@ -108,7 +108,7 @@ bool cdrom_image_device::call_load()
if (software_entry() == nullptr)
{
if ((filetype() == ".chd") && is_loaded()) {
if (is_filetype("chd") && is_loaded()) {
err = m_self_chd.open( image_core_file() ); /* CDs are never writeable */
if ( err )
goto error;

View File

@ -42,7 +42,7 @@ public:
virtual bool must_be_loaded() const override { return 0; }
virtual bool is_reset_on_load() const override { return 0; }
virtual const char *file_extensions() const override { return "mid"; }
virtual bool core_opens_image_file() const override { return FALSE; }
virtual bool core_opens_image_file() const override { return false; }
protected:
// device-level overrides

View File

@ -45,7 +45,7 @@ public:
virtual bool must_be_loaded() const override { return 0; }
virtual bool is_reset_on_load() const override { return 0; }
virtual const char *file_extensions() const override { return "mid"; }
virtual bool core_opens_image_file() const override { return FALSE; }
virtual bool core_opens_image_file() const override { return false; }
virtual void tx(UINT8 state) { rx_w(state); }

View File

@ -332,7 +332,7 @@ CMDERR debugger_console::execute_command(const char *command, bool echo)
printf(">%s\n", command);
/* parse and execute */
result = internal_parse_command(command, TRUE);
result = internal_parse_command(command, true);
/* display errors */
if (result != CMDERR_NONE)

View File

@ -197,23 +197,14 @@ void device_image_interface::set_image_filename(const std::string &filename)
[](char c) { return (c == '\\') || (c == '/') || (c == ':'); });
if (iter != m_image_name.rend())
{
if (*iter == ':')
{
// temp workaround for softlists now that m_image_name contains the part name too (e.g. list:gamename:cart)
m_basename.assign(m_image_name.begin(), std::next(iter).base());
int tmploc = m_basename.find_last_of(':');
m_basename = m_basename.substr(tmploc + 1);
}
else
m_basename.assign(iter.base(), m_image_name.end());
}
m_basename.assign(iter.base(), m_image_name.end());
m_basename_noext = m_basename;
auto loc = m_basename_noext.find_last_of('.');
if (loc != std::string::npos)
m_basename_noext = m_basename_noext.substr(0, loc);
m_filetype = core_filename_extract_extension(m_basename, true, true);
m_filetype = core_filename_extract_extension(m_basename, true);
}
@ -932,10 +923,6 @@ bool device_image_interface::load_internal(const std::string &path, bool is_crea
{
UINT32 open_plan[4];
int i;
bool softload = false;
// if the path contains no period, we are using softlists, so we won't create an image
bool filename_has_period = (path.find_last_of('.') != -1);
// first unload the image
unload();
@ -951,30 +938,7 @@ bool device_image_interface::load_internal(const std::string &path, bool is_crea
if (core_opens_image_file())
{
// Check if there's a software list defined for this device and use that if we're not creating an image
if (!filename_has_period && !just_load)
{
softload = load_software_part(path.c_str(), m_software_part_ptr);
if (softload)
{
m_software_info_ptr = &m_software_part_ptr->info();
m_software_list_name.assign(m_software_info_ptr->list().list_name());
m_full_software_name.assign(m_software_part_ptr->info().shortname());
// if we had launched from softlist with a specified part, e.g. "shortname:part"
// we would have recorded the wrong name, so record it again based on software_info
if (m_software_info_ptr && !m_full_software_name.empty())
set_image_filename(m_full_software_name);
// check if image should be read-only
const char *read_only = get_feature("read_only");
if (read_only && !strcmp(read_only, "true")) {
make_readonly();
}
}
}
if (is_create || filename_has_period)
if (is_create)
{
// determine open plan
determine_open_plan(is_create, open_plan);
@ -989,28 +953,8 @@ bool device_image_interface::load_internal(const std::string &path, bool is_crea
}
}
// Copy some image information when we have been loaded through a software list
if ( m_software_info_ptr )
{
// sanitize
if (m_software_info_ptr->longname().empty() || m_software_info_ptr->publisher().empty() || m_software_info_ptr->year().empty())
fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n");
// store
m_longname = m_software_info_ptr->longname();
m_manufacturer = m_software_info_ptr->publisher();
m_year = m_software_info_ptr->year();
//m_playable = m_software_info_ptr->supported();
// set file type
std::string filename = (m_mame_file != nullptr) && (m_mame_file->filename() != nullptr)
? m_mame_file->filename()
: "";
m_filetype = core_filename_extract_extension(filename, true, true);
}
// did we fail to find the file?
if (!is_loaded() && !softload)
if (!is_loaded())
{
m_err = IMAGE_ERROR_FILENOTFOUND;
goto done;
@ -1022,7 +966,7 @@ bool device_image_interface::load_internal(const std::string &path, bool is_crea
m_create_args = create_args;
if (m_init_phase==false) {
m_err = (image_error_t)finish_load();
m_err = (finish_load()==IMAGE_INIT_PASS) ? IMAGE_ERROR_SUCCESS : IMAGE_ERROR_INTERNAL;
if (m_err)
goto done;
}
@ -1044,10 +988,8 @@ done:
clear();
}
else {
/* do we need to reset the CPU? only schedule it if load/create is successful */
if (device().machine().time() > attotime::zero && is_reset_on_load())
device().machine().schedule_hard_reset();
else
// do we need to reset the CPU? only schedule it if load/create is successful
if (!schedule_postload_hard_reset_if_needed())
{
if (!m_init_phase)
{
@ -1062,6 +1004,18 @@ done:
}
//-------------------------------------------------
// schedule_postload_hard_reset_if_needed
//-------------------------------------------------
bool device_image_interface::schedule_postload_hard_reset_if_needed()
{
bool postload_hard_reset_needed = device().machine().time() > attotime::zero && is_reset_on_load();
if (postload_hard_reset_needed)
device().machine().schedule_hard_reset();
return postload_hard_reset_needed;
}
//-------------------------------------------------
// load - load an image into MAME
@ -1073,6 +1027,82 @@ bool device_image_interface::load(const char *path)
}
//-------------------------------------------------
// load_software - loads a softlist item by name
//-------------------------------------------------
bool device_image_interface::load_software(const std::string &softlist_name)
{
// Prepare to load
unload();
clear_error();
m_is_loading = true;
// Check if there's a software list defined for this device and use that if we're not creating an image
bool softload = load_software_part(softlist_name.c_str(), m_software_part_ptr);
if (!softload)
{
m_is_loading = false;
return IMAGE_INIT_FAIL;
}
// set up softlist stuff
m_software_info_ptr = &m_software_part_ptr->info();
m_software_list_name.assign(m_software_info_ptr->list().list_name());
m_full_software_name.assign(m_software_part_ptr->info().shortname());
// specify image name with softlist-derived names
m_image_name = m_full_software_name;
m_basename = m_full_software_name;
m_basename_noext = m_full_software_name;
m_filetype = "";
// check if image should be read-only
const char *read_only = get_feature("read_only");
if (read_only && !strcmp(read_only, "true"))
{
make_readonly();
// Copy some image information when we have been loaded through a software list
if (m_software_info_ptr)
{
// sanitize
if (m_software_info_ptr->longname().empty() || m_software_info_ptr->publisher().empty() || m_software_info_ptr->year().empty())
fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n");
// store
m_longname = m_software_info_ptr->longname();
m_manufacturer = m_software_info_ptr->publisher();
m_year = m_software_info_ptr->year();
// set file type
std::string filename = (m_mame_file != nullptr) && (m_mame_file->filename() != nullptr)
? m_mame_file->filename()
: "";
m_filetype = core_filename_extract_extension(filename, true);
}
}
// call finish_load if necessary
if (m_init_phase == false && finish_load())
return IMAGE_INIT_FAIL;
// do we need to reset the CPU? only schedule it if load is successful
if (!schedule_postload_hard_reset_if_needed())
{
if (!m_init_phase)
{
if (device().machine().phase() == MACHINE_PHASE_RUNNING)
device().popmessage("Image '%s' was successfully loaded.", softlist_name);
else
osd_printf_info("Image '%s' was successfully loaded.\n", softlist_name.c_str());
}
}
return IMAGE_INIT_PASS;
}
//-------------------------------------------------
// open_image_file - opening plain image file
//-------------------------------------------------
@ -1108,7 +1138,7 @@ bool device_image_interface::finish_load()
if (m_created)
{
err = call_create(m_create_format, m_create_args);
if (err)
if (err == IMAGE_INIT_FAIL)
{
if (!m_err)
m_err = IMAGE_ERROR_UNSPECIFIED;
@ -1118,7 +1148,7 @@ bool device_image_interface::finish_load()
{
// using device load
err = call_load();
if (err)
if (err == IMAGE_INIT_FAIL)
{
if (!m_err)
m_err = IMAGE_ERROR_UNSPECIFIED;
@ -1166,6 +1196,8 @@ void device_image_interface::clear()
m_image_name.clear();
m_readonly = false;
m_created = false;
m_create_format = 0;
m_create_args = nullptr;
m_longname.clear();
m_manufacturer.clear();

View File

@ -101,7 +101,7 @@ class software_part;
class software_info;
// device image interface function types
typedef delegate<int (device_image_interface &)> device_image_load_delegate;
typedef delegate<bool (device_image_interface &)> device_image_load_delegate;
typedef delegate<void (device_image_interface &)> device_image_func_delegate;
// legacy
typedef void (*device_image_partialhash_func)(util::hash_collection &, const unsigned char *, unsigned long, const char *);
@ -110,15 +110,13 @@ typedef void (*device_image_partialhash_func)(util::hash_collection &, const uns
// MACROS
//**************************************************************************
#define IMAGE_INIT_PASS FALSE
#define IMAGE_INIT_FAIL TRUE
#define IMAGE_VERIFY_PASS FALSE
#define IMAGE_VERIFY_FAIL TRUE
#define IMAGE_INIT_PASS false
#define IMAGE_INIT_FAIL true
#define DEVICE_IMAGE_LOAD_MEMBER_NAME(_name) device_image_load_##_name
#define DEVICE_IMAGE_LOAD_NAME(_class,_name) _class::DEVICE_IMAGE_LOAD_MEMBER_NAME(_name)
#define DECLARE_DEVICE_IMAGE_LOAD_MEMBER(_name) int DEVICE_IMAGE_LOAD_MEMBER_NAME(_name)(device_image_interface &image)
#define DEVICE_IMAGE_LOAD_MEMBER(_class,_name) int DEVICE_IMAGE_LOAD_NAME(_class,_name)(device_image_interface &image)
#define DECLARE_DEVICE_IMAGE_LOAD_MEMBER(_name) bool DEVICE_IMAGE_LOAD_MEMBER_NAME(_name)(device_image_interface &image)
#define DEVICE_IMAGE_LOAD_MEMBER(_class,_name) bool DEVICE_IMAGE_LOAD_NAME(_class,_name)(device_image_interface &image)
#define DEVICE_IMAGE_LOAD_DELEGATE(_class,_name) device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_name),#_class "::device_image_load_" #_name, downcast<_class *>(device->owner()))
#define DEVICE_IMAGE_UNLOAD_MEMBER_NAME(_name) device_image_unload_##_name
@ -149,12 +147,12 @@ public:
virtual void device_compute_hash(util::hash_collection &hashes, const void *data, size_t length, const char *types) const;
virtual bool call_load() { return FALSE; }
virtual bool call_create(int format_type, util::option_resolution *format_options) { return FALSE; }
virtual bool call_load() { return IMAGE_INIT_PASS; }
virtual bool call_create(int format_type, util::option_resolution *format_options) { return IMAGE_INIT_PASS; }
virtual void call_unload() { }
virtual std::string call_display() { return std::string(); }
virtual device_image_partialhash_func get_partial_hash() const { return nullptr; }
virtual bool core_opens_image_file() const { return TRUE; }
virtual bool core_opens_image_file() const { return true; }
virtual iodevice_t image_type() const = 0;
virtual bool is_readable() const = 0;
virtual bool is_writeable() const = 0;
@ -178,6 +176,7 @@ public:
const char *basename() const { if (m_basename.empty()) return nullptr; else return m_basename.c_str(); }
const char *basename_noext() const { if (m_basename_noext.empty()) return nullptr; else return m_basename_noext.c_str(); }
const std::string &filetype() const { return m_filetype; }
bool is_filetype(const std::string &candidate_filetype) { return !core_stricmp(filetype().c_str(), candidate_filetype.c_str()); }
bool is_open() const { return bool(m_file); }
util::core_file &image_core_file() const { return *m_file; }
UINT64 length() { check_for_file(); return m_file->size(); }
@ -194,7 +193,7 @@ public:
int image_feof() { check_for_file(); return m_file->eof(); }
void *ptr() {check_for_file(); return const_cast<void *>(m_file->buffer()); }
// configuration access
void set_init_phase() { m_init_phase = TRUE; }
void set_init_phase() { m_init_phase = true; }
const char* longname() const { return m_longname.c_str(); }
const char* manufacturer() const { return m_manufacturer.c_str(); }
@ -228,7 +227,12 @@ public:
bool uses_file_extension(const char *file_extension) const;
const formatlist_type &formatlist() const { return m_formatlist; }
// loads an image file
bool load(const char *path);
// loads a softlist item by name
bool load_software(const std::string &softlist_name);
bool open_image_file(emu_options &options);
bool finish_load();
void unload();
@ -294,15 +298,22 @@ protected:
std::string m_basename_noext;
std::string m_filetype;
// working directory; persists across mounts
std::string m_working_directory;
// Software information
std::string m_full_software_name;
const software_info *m_software_info_ptr;
const software_part *m_software_part_ptr;
std::string m_software_list_name;
private:
static image_error_t image_error_from_file_error(osd_file::error filerr);
bool schedule_postload_hard_reset_if_needed();
// creation info
formatlist_type m_formatlist;
// working directory; persists across mounts
std::string m_working_directory;
// info read from the hash file/software list
std::string m_longname;
std::string m_manufacturer;
@ -328,12 +339,6 @@ protected:
bool m_user_loadable;
bool m_is_loading;
private:
static image_error_t image_error_from_file_error(osd_file::error filerr);
// creation info
formatlist_type m_formatlist;
};
// iterator

View File

@ -2,13 +2,15 @@
// copyright-holders:Nathan Woods, Miodrag Milanovic
/***************************************************************************
image.c
image.cpp
Core image functions and definitions.
***************************************************************************/
#include <ctype.h>
#include <regex>
#include "emu.h"
#include "emuopts.h"
@ -16,6 +18,13 @@
#include "config.h"
#include "xmlfile.h"
//**************************************************************************
// STATIC VARIABLES
//**************************************************************************
static std::regex s_softlist_regex("\\w+\\:\\w+\\:\\w+");
//**************************************************************************
// IMAGE MANAGER
//**************************************************************************
@ -27,35 +36,42 @@
image_manager::image_manager(running_machine &machine)
: m_machine(machine)
{
/* make sure that any required devices have been allocated */
// make sure that any required devices have been allocated
for (device_image_interface &image : image_interface_iterator(machine.root_device()))
{
/* is an image specified for this image */
const char *image_name = machine.options().value(image.instance_name());
// ignore things not user loadable
if (!image.user_loadable())
continue;
if ((image_name != nullptr) && (image_name[0] != '\0'))
// is an image specified for this image
const char *image_name_ptr = machine.options().value(image.instance_name());
if ((image_name_ptr != nullptr) && (image_name_ptr[0] != '\0'))
{
/* mark init state */
std::string image_name(image_name_ptr);
// mark init state
image.set_init_phase();
/* try to load this image */
bool result = image.load(image_name);
// is this image really a softlist part?
bool is_softlist_part = std::regex_match(image_name, s_softlist_regex);
/* did the image load fail? */
// try to load this image
bool result = is_softlist_part
? image.load_software(image_name)
: image.load(image_name.c_str());
// did the image load fail?
if (result)
{
/* retrieve image error message */
// retrieve image error message
std::string image_err = std::string(image.error());
std::string image_basename(image_name);
/* unload all images */
// unload all images
unload_all();
fatalerror_exitcode(machine, EMU_ERR_DEVICE, "Device %s load (%s) failed: %s",
image.device().name(),
image_basename.c_str(),
image_name.c_str(),
image_err.c_str());
}
}

View File

@ -718,7 +718,7 @@ bool input_seq::is_valid() const
// non-switch items can't have a NOT
input_item_class itemclass = code.item_class();
if (itemclass != ITEM_CLASS_SWITCH && lastcode == not_code)
return FALSE;
return false;
// absolute/relative items must all be the same class
if ((lastclass == ITEM_CLASS_ABSOLUTE && itemclass != ITEM_CLASS_ABSOLUTE) ||

View File

@ -576,13 +576,13 @@ int rom_load_manager::open_rom_file(const char *regiontag, const rom_entry *romp
// is actually a concatenation of: listname + setname + parentname
// separated by '%' (parentname being present only for clones)
std::string tag1(regiontag), tag2, tag3, tag4, tag5;
bool is_list = FALSE;
bool has_parent = FALSE;
bool is_list = false;
bool has_parent = false;
int separator1 = tag1.find_first_of('%');
if (separator1 != -1)
{
is_list = TRUE;
is_list = true;
// we are loading through softlists, split the listname from the regiontag
tag4.assign(tag1.substr(separator1 + 1, tag1.length() - separator1 + 1));
@ -593,7 +593,7 @@ int rom_load_manager::open_rom_file(const char *regiontag, const rom_entry *romp
int separator2 = tag4.find_first_of('%');
if (separator2 != -1)
{
has_parent = TRUE;
has_parent = true;
// we are loading a clone through softlists, split the setname from the parentname
tag5.assign(tag4.substr(separator2 + 1, tag4.length() - separator2 + 1));
@ -983,13 +983,13 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_
// is actually a concatenation of: listname + setname + parentname
// separated by '%' (parentname being present only for clones)
std::string tag1(locationtag), tag2, tag3, tag4, tag5;
bool is_list = FALSE;
bool has_parent = FALSE;
bool is_list = false;
bool has_parent = false;
int separator1 = tag1.find_first_of('%');
if (separator1 != -1)
{
is_list = TRUE;
is_list = true;
// we are loading through softlists, split the listname from the regiontag
tag4.assign(tag1.substr(separator1 + 1, tag1.length() - separator1 + 1));
@ -1000,7 +1000,7 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_
int separator2 = tag4.find_first_of('%');
if (separator2 != -1)
{
has_parent = TRUE;
has_parent = true;
// we are loading a clone through softlists, split the setname from the parentname
tag5.assign(tag4.substr(separator2 + 1, tag4.length() - separator2 + 1));
@ -1357,7 +1357,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list
/* now process the entries in the region */
if (ROMREGION_ISROMDATA(region))
process_rom_entries(locationtag.c_str(), region, region + 1, &device, TRUE);
process_rom_entries(locationtag.c_str(), region, region + 1, &device, true);
else if (ROMREGION_ISDISKDATA(region))
process_disk_entries(regiontag.c_str(), region, region + 1, locationtag.c_str());
}
@ -1370,7 +1370,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list
}
/* display the results and exit */
display_rom_load_results(TRUE);
display_rom_load_results(true);
}
@ -1422,7 +1422,7 @@ void rom_load_manager::process_region_list()
#endif
/* now process the entries in the region */
process_rom_entries(device.shortname(), region, region + 1, &device, FALSE);
process_rom_entries(device.shortname(), region, region + 1, &device, false);
}
else if (ROMREGION_ISDISKDATA(region))
process_disk_entries(regiontag.c_str(), region, region + 1, nullptr);
@ -1483,5 +1483,5 @@ rom_load_manager::rom_load_manager(running_machine &machine)
process_region_list();
/* display the results and exit */
display_rom_load_results(FALSE);
display_rom_load_results(false);
}

View File

@ -1143,14 +1143,14 @@ bool screen_device::update_partial(int scanline)
if (machine().video().skip_this_frame())
{
LOG_PARTIAL_UPDATES(("skipped due to frameskipping\n"));
return FALSE;
return false;
}
// skip if this screen is not visible anywhere
if (!machine().render().is_live(*this))
{
LOG_PARTIAL_UPDATES(("skipped because screen not live\n"));
return FALSE;
return false;
}
}

View File

@ -1620,7 +1620,7 @@ void cli_frontend::getsoftlist(const char *gamename)
{
FILE *out = stdout;
std::unordered_set<std::string> list_map;
bool isfirst = TRUE;
bool isfirst = true;
driver_enumerator drivlist(m_options);
while (drivlist.next())
@ -1629,7 +1629,7 @@ void cli_frontend::getsoftlist(const char *gamename)
if (core_strwildcmp(gamename, swlistdev.list_name()) == 0 && list_map.insert(swlistdev.list_name()).second)
if (!swlistdev.get_info().empty())
{
if (isfirst) { fprintf( out, SOFTLIST_XML_BEGIN); isfirst = FALSE; }
if (isfirst) { fprintf( out, SOFTLIST_XML_BEGIN); isfirst = false; }
output_single_softlist(out, swlistdev);
}
}

View File

@ -268,7 +268,7 @@ void info_xml_creator::output_one()
{
if (field.type() == IPT_KEYBOARD)
{
if (!new_kbd) new_kbd = TRUE;
if (!new_kbd) new_kbd = true;
field.set_player(field.player() + kbd_offset);
}
else
@ -355,11 +355,11 @@ void info_xml_creator::output_one()
void info_xml_creator::output_one_device(device_t &device, const char *devtag)
{
bool has_speaker = FALSE, has_input = FALSE;
bool has_speaker = false, has_input = false;
// check if the device adds speakers to the system
sound_interface_iterator snditer(device);
if (snditer.first() != nullptr)
has_speaker = TRUE;
has_speaker = true;
// generate input list
ioport_list portlist;
std::string errors;
@ -370,7 +370,7 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag)
for (ioport_field &field : port.second->fields())
if (field.type() >= IPT_START1 && field.type() < IPT_UI_FIRST)
{
has_input = TRUE;
has_input = true;
break;
}
@ -894,7 +894,7 @@ void info_xml_creator::output_input(const ioport_list &portlist)
for (auto &port : portlist)
{
int ctrl_type = CTRL_DIGITAL_BUTTONS;
bool ctrl_analog = FALSE;
bool ctrl_analog = false;
for (ioport_field &field : port.second->fields())
{
// track the highest player number
@ -996,75 +996,75 @@ void info_xml_creator::output_input(const ioport_list &portlist)
case IPT_AD_STICK_X:
case IPT_AD_STICK_Y:
case IPT_AD_STICK_Z:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_JOYSTICK;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "stick";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_PADDLE:
case IPT_PADDLE_V:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_PADDLE;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "paddle";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_PEDAL:
case IPT_PEDAL2:
case IPT_PEDAL3:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_PEDAL;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "pedal";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_LIGHTGUN_X:
case IPT_LIGHTGUN_Y:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_LIGHTGUN;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "lightgun";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_POSITIONAL:
case IPT_POSITIONAL_V:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_POSITIONAL;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "positional";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_DIAL:
case IPT_DIAL_V:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_DIAL;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "dial";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_TRACKBALL;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "trackball";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
case IPT_MOUSE_X:
case IPT_MOUSE_Y:
ctrl_analog = TRUE;
ctrl_analog = true;
ctrl_type = CTRL_ANALOG_MOUSE;
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "mouse";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = true;
break;
// map buttons
@ -1084,12 +1084,12 @@ void info_xml_creator::output_input(const ioport_list &portlist)
case IPT_BUTTON14:
case IPT_BUTTON15:
case IPT_BUTTON16:
ctrl_analog = FALSE;
ctrl_analog = false;
if (control_info[field.player() * CTRL_COUNT + ctrl_type].type == nullptr)
{
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "only_buttons";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = FALSE;
control_info[field.player() * CTRL_COUNT + ctrl_type].analog = false;
}
control_info[field.player() * CTRL_COUNT + ctrl_type].maxbuttons = std::max(control_info[field.player() * CTRL_COUNT + ctrl_type].maxbuttons, field.type() - IPT_BUTTON1 + 1);
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
@ -1184,7 +1184,7 @@ void info_xml_creator::output_input(const ioport_list &portlist)
if (field.delta() != 0)
control_info[field.player() * CTRL_COUNT + ctrl_type].keydelta = field.delta();
if (field.analog_reverse() != 0)
control_info[field.player() * CTRL_COUNT + ctrl_type].reverse = TRUE;
control_info[field.player() * CTRL_COUNT + ctrl_type].reverse = true;
}
}
}
@ -1196,7 +1196,7 @@ void info_xml_creator::output_input(const ioport_list &portlist)
// for lightguns) and therefore we really need this separate loop.
for (int i = 0; i < CTRL_PCOUNT; i++)
{
bool fix_done = FALSE;
bool fix_done = false;
for (int j = 1; j < CTRL_COUNT; j++)
if (control_info[i * CTRL_COUNT].type != nullptr && control_info[i * CTRL_COUNT + j].type != nullptr && !fix_done)
{
@ -1205,7 +1205,7 @@ void info_xml_creator::output_input(const ioport_list &portlist)
control_info[i * CTRL_COUNT + j].maxbuttons = std::max(control_info[i * CTRL_COUNT + j].maxbuttons, control_info[i * CTRL_COUNT].maxbuttons);
memset(&control_info[i * CTRL_COUNT], 0, sizeof(control_info[0]));
fix_done = TRUE;
fix_done = true;
}
}

View File

@ -40,7 +40,7 @@ menu_file_manager::menu_file_manager(mame_ui_manager &mui, render_container &con
else
m_warnings.clear();
m_curr_selected = FALSE;
m_curr_selected = false;
}
@ -180,7 +180,7 @@ void menu_file_manager::handle()
selected_device = (device_image_interface *) event->itemref;
if (selected_device != nullptr)
{
m_curr_selected = TRUE;
m_curr_selected = true;
floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device);
if (floppy_device != nullptr)
{

View File

@ -66,7 +66,7 @@ void menu_control_floppy_image::hook_load(std::string filename, bool softlist)
if (softlist)
{
machine().popmessage("When loaded from software list, the disk is Read-only.\n");
m_image.load(filename.c_str());
m_image.load_software(filename);
stack_pop();
return;
}

View File

@ -281,7 +281,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
// disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver,
// or if we are debugging
if (!first_time || (str > 0 && str < 60*5) || &machine().system() == &GAME_NAME(___empty) || (machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
show_gameinfo = show_warnings = show_mandatory_fileman = FALSE;
show_gameinfo = show_warnings = show_mandatory_fileman = false;
#if defined(EMSCRIPTEN)
// also disable for the JavaScript port since the startup screens do not run asynchronously

View File

@ -343,13 +343,13 @@ struct sector_header
bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
UINT8 header[0x100];
bool extendformat = FALSE;
bool extendformat = false;
UINT64 image_size = io_generic_size(io);
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, EXT_FORMAT_HEADER, 16 ) ==0) {
extendformat = TRUE;
extendformat = true;
}
int heads = header[0x31];

View File

@ -1945,7 +1945,7 @@ avi_file::error avi_file_impl::append_sound_samples(int channel, const std::int1
m_soundbuf_chansamples[channel] = sampoffset;
/* flush any full sound chunks to disk */
return soundbuf_flush(TRUE);
return soundbuf_flush(true);
}

View File

@ -1294,14 +1294,12 @@ std::string core_filename_extract_base(const std::string &name, bool strip_exten
// core_filename_extract_extension
// -------------------------------------------------
std::string core_filename_extract_extension(const std::string &filename, bool strip_period, bool normalize_to_lowercase)
std::string core_filename_extract_extension(const std::string &filename, bool strip_period)
{
auto loc = filename.find_last_of('.');
std::string result = loc != std::string::npos
? filename.substr(loc + (strip_period ? 1 : 0))
: "";
if (normalize_to_lowercase)
std::transform(result.begin(), result.end(), result.begin(), ::tolower);
return result;
}

View File

@ -143,7 +143,7 @@ protected:
std::string core_filename_extract_base(const std::string &name, bool strip_extension = false);
// extracts the file extension from a filename
std::string core_filename_extract_extension(const std::string &filename, bool strip_period = false, bool normalize_to_lowercase = false);
std::string core_filename_extract_extension(const std::string &filename, bool strip_period = false);
// true if the given filename ends with a particular extension
bool core_filename_ends_with(const std::string &filename, const std::string &extension);

View File

@ -710,6 +710,7 @@ void chihiro_state::hack_eeprom()
m_maincpu->space(0).write_byte(0x3b767, 0xc3);
}
#define HACK_ITEMS 4
static const struct {
const char *game_name;
const bool disable_usb;
@ -717,10 +718,11 @@ static const struct {
UINT32 address;
UINT8 write_byte;
} modify[16];
} hacks[3] = { { "chihiro", false, { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } },
{ "outr2", true, { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } },
{ "crtaxihr", false, { { 0x14ada5/*11fda5*/, 0x90 },{ 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } },
};
} hacks[HACK_ITEMS] = { { "chihiro", false, { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } },
{ "outr2", true, { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } },
{ "crtaxihr", false, { { 0x14ada5/*11fda5*/, 0x90 },{ 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } },
{ "ghostsqu", false, { { 0x78833/*4d833*/, 0x90 },{ 0x78834/*4d834*/, 0x90 }, { 0, 0 } } },
};
void chihiro_state::hack_usb()
{
@ -1569,7 +1571,7 @@ void chihiro_state::machine_start()
machine().debugger().console().register_command("chihiro", CMDFLAG_NONE, 0, 1, 4, std::bind(&chihiro_state::debug_commands, this, _1, _2, _3));
}
usbhack_index = -1;
for (int a = 1; a < 3; a++)
for (int a = 1; a < HACK_ITEMS; a++)
if (strcmp(machine().basename(), hacks[a].game_name) == 0) {
usbhack_index = a;
if (hacks[a].disable_usb == true)

View File

@ -352,15 +352,15 @@ void coleco_state::machine_reset()
m_last_nmi_state = 0;
}
//static int coleco_cart_verify(const UINT8 *cartdata, size_t size)
//static bool coleco_cart_verify(const UINT8 *cartdata, size_t size)
//{
// int retval = IMAGE_VERIFY_FAIL;
// int retval = false;
//
// /* Verify the file is in Colecovision format */
// if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */
// retval = IMAGE_VERIFY_PASS;
// retval = true;
// if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */
// retval = IMAGE_VERIFY_PASS;
// retval = true;
//
// return retval;
//}

View File

@ -366,7 +366,7 @@ QUICKLOAD_LOAD_MEMBER( d6800_state, d6800 )
image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length,quick_addr,quick_addr+quick_length,exec_addr);
// Start the quickload
if (image.filetype() == "bin")
if (image.is_filetype("bin"))
m_maincpu->set_pc(quick_addr);
else
m_maincpu->set_pc(exec_addr);

View File

@ -286,7 +286,7 @@ QUICKLOAD_LOAD_MEMBER( eti660_state, eti660 )
space.write_byte(i + quick_addr, quick_data[i]);
/* display a message about the loaded quickload */
if (image.filetype() == "bin")
if (image.is_filetype("bin"))
image.message(" Quickload: size=%04X : start=%04X : end=%04X : Press 6 to start",quick_length,quick_addr,quick_addr+quick_length);
else
image.message(" Quickload: size=%04X : start=%04X : end=%04X : Press 8 to start",quick_length,quick_addr,quick_addr+quick_length);

View File

@ -2018,11 +2018,11 @@ int jaguar_state::quickload(device_image_interface &image, const char *file_type
skip = 96;
else /* ABS binary */
if (image.filetype() == "abs")
if (image.is_filetype("abs"))
start = 0xc000;
else /* JAG binary */
if (image.filetype() == "jag")
if (image.is_filetype("jag"))
start = 0x5000;
@ -2063,7 +2063,7 @@ DEVICE_IMAGE_LOAD_MEMBER( jaguar_state, jaguar_cart )
size = image.length();
/* .rom files load & run at 802000 */
if (image.filetype() == "rom")
if (image.is_filetype("rom"))
{
load_offset = 0x2000; // fix load address
m_cart_base[0x101] = 0x802000; // fix exec address

View File

@ -162,7 +162,7 @@ QUICKLOAD_LOAD_MEMBER( lynx_state, lynx )
return IMAGE_INIT_FAIL;
/* Check the image */
if (lynx_verify_cart((char*)header, LYNX_QUICKLOAD) == IMAGE_VERIFY_FAIL)
if (!lynx_verify_cart((char*)header, LYNX_QUICKLOAD))
return IMAGE_INIT_FAIL;
start = header[3] | (header[2]<<8); //! big endian format in file format for little endian cpu

View File

@ -549,7 +549,7 @@ QUICKLOAD_LOAD_MEMBER(ssem_state, ssem_store)
token_buf[4] = '\0';
sscanf(token_buf, "%04u", &line);
if (image.filetype() == "snp")
if (image.is_filetype("snp"))
{
UINT32 word = 0;
@ -565,7 +565,7 @@ QUICKLOAD_LOAD_MEMBER(ssem_state, ssem_store)
space.write_byte((line << 2) + 2, (word >> 8) & 0x000000ff);
space.write_byte((line << 2) + 3, (word >> 0) & 0x000000ff);
}
else if (image.filetype() == "asm")
else if (image.is_filetype("asm"))
{
char op_buf[4] = { 0 };
INT32 value = 0;

View File

@ -535,7 +535,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state, studio2_cart_load )
if (image.software_entry() == nullptr)
{
if (image.filetype() == "st2")
if (image.is_filetype("st2"))
{
UINT8 header[0x100];
UINT8 catalogue[10], title[32], pages[64];

View File

@ -414,7 +414,7 @@ QUICKLOAD_LOAD_MEMBER( vc4000_state,vc4000)
}
else
{
if (image.filetype() == "tvc")
if (image.is_filetype("tvc"))
{
if (quick_data[0] != 2)
{
@ -455,7 +455,7 @@ QUICKLOAD_LOAD_MEMBER( vc4000_state,vc4000)
}
}
else
if (image.filetype() == "pgm")
if (image.is_filetype("pgm"))
{
if (quick_data[0] != 0)
{

View File

@ -667,13 +667,13 @@ QUICKLOAD_LOAD_MEMBER( vip_state, vip )
int chip8_size = 0;
int size = image.length();
if (image.filetype() == "c8")
if (image.is_filetype("c8"))
{
/* CHIP-8 program */
chip8_ptr = m_chip8->base();
chip8_size = m_chip8->bytes();
}
else if (image.filetype() == "c8x")
else if (image.is_filetype("c8x"))
{
/* CHIP-8X program */
chip8_ptr = m_chip8x->base();

View File

@ -57,7 +57,7 @@ public:
void lviv_update_memory ();
void lviv_setup_snapshot (UINT8 * data);
void dump_registers();
int lviv_verify_snapshot (UINT8 * data, UINT32 size);
bool lviv_verify_snapshot (UINT8 * data, UINT32 size);
DECLARE_SNAPSHOT_LOAD_MEMBER( lviv );
DECLARE_INPUT_CHANGED_MEMBER(lviv_reset);
};

View File

@ -181,7 +181,7 @@ public:
void lynx_timer_count_down(int which);
UINT32 lynx_time_factor(int val);
void lynx_uart_reset();
int lynx_verify_cart (char *header, int kind);
bool lynx_verify_cart (char *header, int kind);
DECLARE_QUICKLOAD_LOAD_MEMBER( lynx );
protected:

View File

@ -88,7 +88,7 @@ public:
UINT8 read_dsw();
void microtan_set_irq_line();
void store_key(int key);
int microtan_verify_snapshot(UINT8 *data, int size);
bool microtan_verify_snapshot(UINT8 *data, int size);
int parse_intel_hex(UINT8 *snapshot_buff, char *src);
int parse_zillion_hex(UINT8 *snapshot_buff, char *src);
void microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base);

View File

@ -144,28 +144,28 @@ void atari_fdc_device::atari_load_proc(device_image_interface &image, bool is_cr
//m_drv[id].image = (UINT8*)image.image_realloc(m_drv[id].image, size);
/* no extension: assume XFD format (no header) */
if (image.filetype() == "")
if (image.is_filetype(""))
{
m_drv[id].type = FORMAT_XFD;
m_drv[id].header_skip = 0;
}
else
/* XFD extension */
if( image.filetype() == "xfd" )
if( image.is_filetype("xfd") )
{
m_drv[id].type = FORMAT_XFD;
m_drv[id].header_skip = 0;
}
else
/* ATR extension */
if( image.filetype() == "atr" )
if( image.is_filetype("atr") )
{
m_drv[id].type = FORMAT_ATR;
m_drv[id].header_skip = 16;
}
else
/* DSK extension */
if( image.filetype() == "dsk" )
if( image.is_filetype("dsk") )
{
m_drv[id].type = FORMAT_DSK;
m_drv[id].header_skip = sizeof(atari_dsk_format);

View File

@ -281,24 +281,24 @@ void lviv_state::dump_registers()
logerror("HL = %04x\n", (unsigned) m_maincpu->state_int(I8085_HL));
}
int lviv_state::lviv_verify_snapshot (UINT8 * data, UINT32 size)
bool lviv_state::lviv_verify_snapshot (UINT8 * data, UINT32 size)
{
const char* tag = "LVOV/DUMP/2.0/";
if( strncmp( tag, (char*)data, strlen(tag) ) )
{
logerror("Not a Lviv snapshot\n");
return IMAGE_VERIFY_FAIL;
return false;
}
if (size != LVIV_SNAPSHOT_SIZE)
{
logerror ("Incomplete snapshot file\n");
return IMAGE_VERIFY_FAIL;
return false;
}
logerror("returning ID_OK\n");
return IMAGE_VERIFY_PASS;
return true;
}
SNAPSHOT_LOAD_MEMBER( lviv_state, lviv )
@ -307,7 +307,7 @@ SNAPSHOT_LOAD_MEMBER( lviv_state, lviv )
image.fread( &lviv_snapshot_data[0], LVIV_SNAPSHOT_SIZE);
if(lviv_verify_snapshot(&lviv_snapshot_data[0], snapshot_size) == IMAGE_VERIFY_FAIL)
if(!lviv_verify_snapshot(&lviv_snapshot_data[0], snapshot_size))
{
return IMAGE_INIT_FAIL;
}

View File

@ -2030,14 +2030,14 @@ void lynx_state::machine_start()
****************************************/
int lynx_state::lynx_verify_cart (char *header, int kind)
bool lynx_state::lynx_verify_cart (char *header, int kind)
{
if (kind)
{
if (strncmp("BS93", &header[6], 4))
{
logerror("This is not a valid Lynx image\n");
return IMAGE_VERIFY_FAIL;
return false;
}
}
else
@ -2051,11 +2051,11 @@ int lynx_state::lynx_verify_cart (char *header, int kind)
}
else
logerror("This is not a valid Lynx image\n");
return IMAGE_VERIFY_FAIL;
return false;
}
}
return IMAGE_VERIFY_PASS;
return true;
}
DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
@ -2069,7 +2069,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
if (image.software_entry() == nullptr)
{
// check for lnx header
if (image.filetype() == "lnx")
if (image.is_filetype("lnx"))
{
// 64 byte header
// LYNX
@ -2081,7 +2081,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
image.fread(header, 0x40);
// Check the image
if (lynx_verify_cart((char*)header, LYNX_CART) == IMAGE_VERIFY_FAIL)
if (!lynx_verify_cart((char*)header, LYNX_CART))
return IMAGE_INIT_FAIL;
/* 2008-10 FP: According to Handy source these should be page_size_bank0. Are we using
@ -2100,9 +2100,9 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
// set-up granularity
if (image.software_entry() == nullptr)
{
if (image.filetype() == "lnx") // from header
if (image.is_filetype("lnx")) // from header
m_granularity = gran;
else if (image.filetype() == "lyx")
else if (image.is_filetype("lyx"))
{
/* 2008-10 FP: FIXME: .lyx file don't have an header, hence they miss "lynx_granularity"
(see above). What if bank 0 has to be loaded elsewhere? And what about bank 1?

View File

@ -627,7 +627,7 @@ QUICKLOAD_LOAD_MEMBER( mbee_state, mbee )
UINT16 i, j;
UINT8 data, sw = m_io_config->read() & 1; /* reading the config switch: 1 = autorun */
if (image.filetype() == "mwb")
if (image.is_filetype("mwb"))
{
/* mwb files - standard basic files */
for (i = 0; i < quickload_size; i++)
@ -657,7 +657,7 @@ QUICKLOAD_LOAD_MEMBER( mbee_state, mbee )
else
space.write_word(0xa2,0x8517);
}
else if (image.filetype() == "com")
else if (image.is_filetype("com"))
{
/* com files - most com files are just machine-language games with a wrapper and don't need cp/m to be present */
for (i = 0; i < quickload_size; i++)
@ -681,7 +681,7 @@ QUICKLOAD_LOAD_MEMBER( mbee_state, mbee )
if (sw) m_maincpu->set_pc(0x100);
}
else if (image.filetype() == "bee")
else if (image.is_filetype("bee"))
{
/* bee files - machine-language games that start at 0900 */
for (i = 0; i < quickload_size; i++)

View File

@ -522,23 +522,23 @@ void microtan_state::machine_reset()
output().set_led_value(1, (m_keyrows[3] & 0x80) ? 0 : 1);
}
int microtan_state::microtan_verify_snapshot(UINT8 *data, int size)
bool microtan_state::microtan_verify_snapshot(UINT8 *data, int size)
{
if (size == 8263)
{
logerror("microtan_snapshot_id: magic size %d found\n", size);
return IMAGE_VERIFY_PASS;
return true;
}
else
{
if (4 + data[2] + 256 * data[3] + 1 + 16 + 16 + 16 + 1 + 1 + 16 + 16 + 64 + 7 == size)
{
logerror("microtan_snapshot_id: header RAM size + structures matches filesize %d\n", size);
return IMAGE_VERIFY_PASS;
return true;
}
}
return IMAGE_VERIFY_FAIL;
return false;
}
int microtan_state::parse_intel_hex(UINT8 *snapshot_buff, char *src)
@ -827,7 +827,7 @@ SNAPSHOT_LOAD_MEMBER( microtan_state, microtan )
if (!snapshot_buff)
return IMAGE_INIT_FAIL;
if (microtan_verify_snapshot(snapshot_buff, snapshot_size)==IMAGE_VERIFY_FAIL)
if (!microtan_verify_snapshot(snapshot_buff, snapshot_size))
return IMAGE_INIT_FAIL;
microtan_snapshot_copy(snapshot_buff, snapshot_size);

View File

@ -8,7 +8,7 @@
memory
-------------------------------------------------*/
int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr )
bool z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr )
{
int ch;
UINT16 args[3];

View File

@ -13,6 +13,6 @@
#ifndef __Z80_BIN__
#define __Z80_BIN__
int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr );
bool z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr );
#endif

View File

@ -2366,7 +2366,7 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, nv2avertex_t *desti
// should use either the vertex program or transformation matrices
if (vertex_pipeline == 4) {
// transformation matrices
// it is not implemented, so we pretend its always using screen coordinates
// this part needs more testing
for (m = 0; m < count; m++) {
for (int i = 0; i < 4; i++) {
t[i] = 0;
@ -2378,7 +2378,8 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, nv2avertex_t *desti
for (int j = 0; j < 4; j++)
v[i] += matrix.projection[i][j] * t[j];
};
/*for (int i = 0; i < 3; i++) {
/* it seems these are not needed ?
for (int i = 0; i < 3; i++) {
v[i] *= matrix.scale[i];
}
for (int i = 0; i < 3; i++) {
@ -2400,6 +2401,7 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, nv2avertex_t *desti
// vertex program
// run vertex program
vertexprogram.exec.process(vertexprogram.start_instruction, source, vert, count);
// the output of the vertex program has the perspective divide, viewport scale and offset already applied
// copy data for poly.c
for (m = 0; m < count; m++) {
destination[m].w = vert[m].attribute[0].fv[3];
@ -2680,6 +2682,15 @@ UINT32 nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, render
vi[2] = &_v3;
for (int n=0;n < 3;n++)
{
// remove translate
vi[n]->x = vi[n]->x - translatex;
vi[n]->y = vi[n]->y - translatey;
vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] - translatez;
// remove scale
vi[n]->x = vi[n]->x / scalex;
vi[n]->y = vi[n]->y / scaley;
vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] / scalez;
// remove perspective divide
vi[n]->x = vi[n]->x * vi[n]->w;
vi[n]->y = vi[n]->y * vi[n]->w;
vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] * vi[n]->w;
@ -2715,16 +2726,26 @@ UINT32 nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, render
}
for (int n = 0; n < idx; n++)
{
// apply perspective divide
vo[n].x = vo[n].x / vo[n].w;
vo[n].y = vo[n].y / vo[n].w;
vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] / vo[n].w;
// apply scale
vo[n].x = vo[n].x * scalex;
vo[n].y = vo[n].y * scaley;
vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] * scalez;
// apply translate
vo[n].x = vo[n].x + translatex;
vo[n].y = vo[n].y + translatey;
vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] + translatez;
}
for (int n = 0; n < (idx-2); n++)
{
if ((n & 1) == 0)
render_triangle_culling(cliprect, callback, paramcount, vo[n], vo[n + 1], vo[n + 2]);
else
render_triangle_culling(cliprect, callback, paramcount, vo[n], vo[n + 2], vo[n + 1]);
}
if (idx > 2)
render_triangle_culling(cliprect, callback, paramcount, vo[0], vo[1], vo[2]);
if (idx > 3)
render_triangle_culling(cliprect, callback, paramcount, vo[0], vo[2], vo[3]);
if (idx > 4)
exit(0);
#endif
return 0;
}
@ -2869,7 +2890,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN
data = space.read_dword(address);
channel[chanel][subchannel].object.method[method] = data;
#ifdef LOG_NV2A
printf("A:%08X MTHD:%08X D:%08X\n\r",address,maddress,data);
//printf("A:%08X MTHD:%08X D:%08X\n\r",address,maddress,data);
#endif
if (maddress == 0x17fc) {
#if 0 // useful while debugging to see what coordinates have been used
@ -3489,6 +3510,10 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN
*(UINT32 *)(&matrix.translate[maddress]) = data;
// set corresponding vertex shader constant too
vertexprogram.exec.c_constant[59].iv[maddress] = data; // constant -37
#ifdef LOG_NV2A
if (maddress == 3)
machine().logerror("viewport translate = {%f %f %f %f}\n", matrix.translate[0], matrix.translate[1], matrix.translate[2], matrix.translate[3]);
#endif
countlen--;
}
// viewport scale
@ -3497,6 +3522,10 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN
*(UINT32 *)(&matrix.scale[maddress]) = data;
// set corresponding vertex shader constant too
vertexprogram.exec.c_constant[58].iv[maddress] = data; // constant -38
#ifdef LOG_NV2A
if (maddress == 3)
machine().logerror("viewport scale = {%f %f %f %f}\n", matrix.scale[0], matrix.scale[1], matrix.scale[2], matrix.scale[3]);
#endif
countlen--;
}
// Vertex program (shader)
@ -3557,6 +3586,15 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN
machine().logerror("Need to increase size of vertexprogram.parameter to %d\n\r", vertexprogram.upload_parameter_index);
vertexprogram.upload_parameter_component++;
if (vertexprogram.upload_parameter_component >= 4) {
#ifdef LOG_NV2A
if ((vertexprogram.upload_parameter_index == 58) || (vertexprogram.upload_parameter_index == 59))
machine().logerror("vp constant %d (%s) = {%f %f %f %f}\n", vertexprogram.upload_parameter_index,
vertexprogram.upload_parameter_index == 58 ? "viewport scale" : "viewport translate",
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[0],
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[1],
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[2],
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[3]);
#endif
vertexprogram.upload_parameter_component = 0;
vertexprogram.upload_parameter_index++;
}
@ -4616,6 +4654,9 @@ WRITE32_MEMBER(nv2a_renderer::geforce_w)
dmaget = &channel[chanel][0].regs[0x44 / 4];
//printf("dmaget %08X dmaput %08X\n\r",*dmaget,*dmaput);
if (((*dmaput == 0x048cf000) && (*dmaget == 0x07f4d000)) || // only for outr2
((*dmaput == 0x045cd000) && (*dmaget == 0x07f4d000)) || // only for scg06nt
((*dmaput == 0x0494c000) && (*dmaget == 0x07f4d000)) || // only for wangmid
((*dmaput == 0x05acd000) && (*dmaget == 0x07f4d000)) || // only for ghostsqu
((*dmaput == 0x07dca000) && (*dmaget == 0x07f4d000))) // only for crtaxihr
{
*dmaget = *dmaput;

View File

@ -583,7 +583,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
if (wholeLineScroll)
{
CGFloat const clamp = [self bounds].size.height - fontHeight - proposedVisibleRect.size.height;
proposedVisibleRect.origin.y = std::min((int)proposedVisibleRect.origin.y, std::max((int)clamp, 0));
proposedVisibleRect.origin.y = std::min(proposedVisibleRect.origin.y, std::max(clamp, CGFloat(0)));
proposedVisibleRect.origin.y -= fmod(proposedVisibleRect.origin.y, fontHeight);
}
return proposedVisibleRect;
@ -668,7 +668,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
inTextContainer:textContainer];
if (start == 0)
box.origin.x = 0;
box.size.width = std::max((int)([self bounds].size.width - box.origin.x), 0);
box.size.width = std::max([self bounds].size.width - box.origin.x, CGFloat(0));
[[self backgroundForAttribute:attr] set];
[NSBezierPath fillRect:NSMakeRect(box.origin.x,
row * fontHeight,

View File

@ -350,7 +350,7 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
windowFrame.size.height = std::min(windowFrame.size.height, available.size.height);
// arbitrary additional height limit
windowFrame.size.height = std::min((int)windowFrame.size.height, 320);
windowFrame.size.height = std::min(windowFrame.size.height, CGFloat(320));
// place it in the bottom right corner and apply
windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width;

View File

@ -44,7 +44,7 @@
borderType:[logScroll borderType]];
// this thing starts with no content, so its prefered height may be very small
desired.height = std::max((int)desired.height, 240);
desired.height = std::max(desired.height, CGFloat(240));
[self cascadeWindowWithDesiredSize:desired forView:logScroll];
}

View File

@ -464,10 +464,10 @@ class input_module_base : public input_module
public:
input_module_base(const char *type, const char* name)
: input_module(type, name),
m_input_enabled(FALSE),
m_mouse_enabled(FALSE),
m_lightgun_enabled(FALSE),
m_input_paused(FALSE),
m_input_enabled(false),
m_mouse_enabled(false),
m_lightgun_enabled(false),
m_input_paused(false),
m_options(nullptr)
{
}

View File

@ -523,7 +523,7 @@ protected:
{
// Only handle raw input data
if (!input_enabled() || eventid != INPUT_EVENT_RAWINPUT)
return FALSE;
return false;
HRAWINPUT rawinputdevice = *static_cast<HRAWINPUT*>(eventdata);
@ -535,11 +535,11 @@ protected:
// ignore if not enabled
if (!input_enabled())
return FALSE;
return false;
// determine the size of databuffer we need
if ((*get_rawinput_data)(rawinputdevice, RID_INPUT, nullptr, &size, sizeof(RAWINPUTHEADER)) != 0)
return FALSE;
return false;
// if necessary, allocate a temporary buffer and fetch the data
if (size > sizeof(small_buffer))
@ -547,7 +547,7 @@ protected:
larger_buffer = std::make_unique<BYTE[]>(size);
data = larger_buffer.get();
if (data == nullptr)
return FALSE;
return false;
}
// fetch the data and process the appropriate message types
@ -567,7 +567,7 @@ protected:
if (input->header.hDevice == devinfo->device_handle())
{
devinfo->queue_events(input, 1);
result = TRUE;
result = true;
}
}
}

View File

@ -95,7 +95,7 @@ public:
bool handle_input_event(input_event eventid, void *eventdata) override
{
if (!input_enabled())
return FALSE;
return false;
KeyPressEventArgs *args;
@ -107,10 +107,10 @@ public:
for (int i = 0; i < devicelist()->size(); i++)
downcast<win32_keyboard_device*>(devicelist()->at(i))->queue_events(args, 1);
return TRUE;
return true;
default:
return FALSE;
return false;
}
}
};
@ -231,13 +231,13 @@ public:
bool handle_input_event(input_event eventid, void *eventdata) override
{
if (!input_enabled() || !mouse_enabled() || eventid != INPUT_EVENT_MOUSE_BUTTON)
return FALSE;
return false;
auto args = static_cast<MouseButtonEventArgs*>(eventdata);
for (int i = 0; i < devicelist()->size(); i++)
downcast<win32_mouse_device*>(devicelist()->at(i))->queue_events(args, 1);
return TRUE;
return true;
}
};

View File

@ -540,19 +540,19 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
options->scanline_bright_offset = winoptions.screen_scanline_bright_offset();
options->scanline_jitter = winoptions.screen_scanline_jitter();
options->hum_bar_alpha = winoptions.screen_hum_bar_alpha();
get_vector(winoptions.screen_defocus(), 2, options->defocus, TRUE);
get_vector(winoptions.screen_converge_x(), 3, options->converge_x, TRUE);
get_vector(winoptions.screen_converge_y(), 3, options->converge_y, TRUE);
get_vector(winoptions.screen_radial_converge_x(), 3, options->radial_converge_x, TRUE);
get_vector(winoptions.screen_radial_converge_y(), 3, options->radial_converge_y, TRUE);
get_vector(winoptions.screen_red_ratio(), 3, options->red_ratio, TRUE);
get_vector(winoptions.screen_grn_ratio(), 3, options->grn_ratio, TRUE);
get_vector(winoptions.screen_blu_ratio(), 3, options->blu_ratio, TRUE);
get_vector(winoptions.screen_offset(), 3, options->offset, TRUE);
get_vector(winoptions.screen_scale(), 3, options->scale, TRUE);
get_vector(winoptions.screen_power(), 3, options->power, TRUE);
get_vector(winoptions.screen_floor(), 3, options->floor, TRUE);
get_vector(winoptions.screen_phosphor(), 3, options->phosphor, TRUE);
get_vector(winoptions.screen_defocus(), 2, options->defocus, true);
get_vector(winoptions.screen_converge_x(), 3, options->converge_x, true);
get_vector(winoptions.screen_converge_y(), 3, options->converge_y, true);
get_vector(winoptions.screen_radial_converge_x(), 3, options->radial_converge_x, true);
get_vector(winoptions.screen_radial_converge_y(), 3, options->radial_converge_y, true);
get_vector(winoptions.screen_red_ratio(), 3, options->red_ratio, true);
get_vector(winoptions.screen_grn_ratio(), 3, options->grn_ratio, true);
get_vector(winoptions.screen_blu_ratio(), 3, options->blu_ratio, true);
get_vector(winoptions.screen_offset(), 3, options->offset, true);
get_vector(winoptions.screen_scale(), 3, options->scale, true);
get_vector(winoptions.screen_power(), 3, options->power, true);
get_vector(winoptions.screen_floor(), 3, options->floor, true);
get_vector(winoptions.screen_phosphor(), 3, options->phosphor, true);
options->saturation = winoptions.screen_saturation();
options->yiq_enable = winoptions.screen_yiq_enable();
options->yiq_jitter = winoptions.screen_yiq_jitter();
@ -572,7 +572,7 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
options->vector_length_ratio = winoptions.screen_vector_length_ratio();
options->bloom_blend_mode = winoptions.screen_bloom_blend_mode();
options->bloom_scale = winoptions.screen_bloom_scale();
get_vector(winoptions.screen_bloom_overdrive(), 3, options->bloom_overdrive, TRUE);
get_vector(winoptions.screen_bloom_overdrive(), 3, options->bloom_overdrive, true);
options->bloom_level0_weight = winoptions.screen_bloom_lvl0_weight();
options->bloom_level1_weight = winoptions.screen_bloom_lvl1_weight();
options->bloom_level2_weight = winoptions.screen_bloom_lvl2_weight();

View File

@ -854,7 +854,7 @@ try_again:
D3DRTYPE_TEXTURE, m_screen_format);
if (FAILED(result) && m_texture_manager->is_dynamic_supported())
{
m_texture_manager->set_dynamic_supported(FALSE);
m_texture_manager->set_dynamic_supported(false);
goto try_again;
}
if (FAILED(result))

View File

@ -81,7 +81,7 @@ private:
EFFECT_COUNT_MAX = 10
};
UINT32 clamped_latency() const { return std::max(std::min(UINT32(m_audio_latency), UINT32(LATENCY_MAX)), UINT32(LATENCY_MIN)); }
UINT32 clamped_latency() const { return unsigned(std::max(std::min(m_audio_latency, int(LATENCY_MAX)), int(LATENCY_MIN))); }
UINT32 buffer_avail() const { return ((m_writepos >= m_playpos) ? m_buffer_size : 0) + m_playpos - m_writepos; }
UINT32 buffer_used() const { return ((m_playpos > m_writepos) ? m_buffer_size : 0) + m_writepos - m_playpos; }
@ -228,7 +228,7 @@ int sound_coreaudio::init(const osd_options &options)
// Allocate buffer
m_headroom = m_sample_bytes * (clamped_latency() * sample_rate() / 40);
m_buffer_size = m_sample_bytes * std::max(UINT32(sample_rate() * (clamped_latency() + 3) / 40), 256U);
m_buffer_size = m_sample_bytes * std::max<UINT32>(sample_rate() * (clamped_latency() + 3) / 40, 256U);
m_buffer = global_alloc_array_clear<INT8>(m_buffer_size);
if (!m_buffer)
{

View File

@ -91,7 +91,7 @@ public:
{
if (!m_signalled)
{
return FALSE;
return false;
}
else
break;

View File

@ -406,7 +406,7 @@ void winwindow_process_events_periodic(running_machine &machine)
// update once every 1/8th of a second
if (currticks - last_event_check < std::chrono::milliseconds(1000 / 8))
return;
winwindow_process_events(machine, TRUE, FALSE);
winwindow_process_events(machine, TRUE, false);
}
@ -415,13 +415,13 @@ void winwindow_process_events_periodic(running_machine &machine)
// is_mame_window
//============================================================
static BOOL is_mame_window(HWND hwnd)
static bool is_mame_window(HWND hwnd)
{
for (auto window : osd_common_t::s_window_list)
if (window->platform_window<HWND>() == hwnd)
return TRUE;
return true;
return FALSE;
return false;
}
inline static BOOL handle_mouse_button(windows_osd_interface *osd, int button, int down, int x, int y)

View File

@ -444,12 +444,12 @@ UINT64 stream_fill(imgtool_stream *f, unsigned char b, UINT64 sz)
char buf[1024];
outsz = 0;
memset(buf, b, std::min(sz, UINT64(sizeof(buf))));
memset(buf, b, (std::min<UINT64>)(sz, sizeof(buf)));
while(sz)
while (sz)
{
outsz += stream_write(f, buf, std::min(sz, UINT64(sizeof(buf))));
sz -= std::min(sz, UINT64(sizeof(buf)));
outsz += stream_write(f, buf, (std::min<UINT64>)(sz, sizeof(buf)));
sz -= (std::min<UINT64>)(sz, sizeof(buf));
}
return outsz;
}