summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Alex W. Jackson <alex.w.jackson@gmail.com>2013-11-05 06:45:44 +0000
committer Alex W. Jackson <alex.w.jackson@gmail.com>2013-11-05 06:45:44 +0000
commit50cdc0f4ae9f07d666341cf3f60c253a71e6f016 (patch)
treee773ebd7a18e0411745d4da084ecb36b84ee4d29
parente0f1c2478fcb6790025d63c7986415e3bdab8593 (diff)
neogeo.c: endian fix for softlist ROM loading [Alex Jackson]
-rw-r--r--src/mame/drivers/neogeo.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c
index 31c28e0bd72..c71c5fadf57 100644
--- a/src/mame/drivers/neogeo.c
+++ b/src/mame/drivers/neogeo.c
@@ -1094,15 +1094,20 @@ DEVICE_IMAGE_LOAD_MEMBER( neogeo_state, neo_cartridge )
size = image.get_software_region_length("maincpu");
machine().memory().region_free(":maincpu");
machine().memory().region_alloc(":maincpu",size, 2, ENDIANNESS_BIG);
- memcpy(memregion("maincpu")->base(),image.get_software_region("maincpu"),size);
// Reset the reference to the region
m_region_maincpu.findit();
- // for whatever reason (intentional, or design flaw) software loaded via software lists is swapped in endianess vs. the standard ROM loading, regardless of the above. Swap it to keep consistency
- for (int i=0; i<size/2;i++)
+
+#ifdef LSB_FIRST
+ // software list ROM loading currently does not fix up endianness for us, so we need to do it by hand
+ UINT16 *src = (UINT16 *)image.get_software_region("maincpu");
+ UINT16 *dst = (UINT16 *)memregion("maincpu")->base();
+ for (int i=0; i<size/2; i++)
{
- UINT16* ROM = (UINT16*)memregion("maincpu")->base();
- ROM[i] = ((ROM[i]&0xff00)>>8) | ((ROM[i]&0x00ff)<<8);
+ dst[i] = FLIPENDIAN_INT16(src[i]);
}
+#else
+ memcpy(memregion("maincpu")->base(),image.get_software_region("maincpu"),size);
+#endif
size = image.get_software_region_length("fixed");
machine().memory().region_free(":fixed");