MisterTea / MAMEHub

Netplay-capable multi-machine emulator
http://www.mamehub.com
119 stars 29 forks source link

All Megadrive games are running with the slowest machine ('megadriv' european 50Hz driver) #283

Open byblo opened 10 years ago

byblo commented 10 years ago

Hello.

Regardless the country of the rom, all Megadrive games are running on the European ('megadriv' driver) machine which lead to some major problems:

For info, ALL (normally) the megadrive roms (bin format) are containing one or more country flag at the offset 496 (0x1F0), which should permit to the emulator or the Mamehub frontend to detect their zone and run the proper machine.

Flags are: J (Japanese) U (USA) E (Europa) There are more flags (and some specific title, see code below), but these 3 should do most of the matching.

Flags can also follow each other inside a rom, or even be missing. For instance, finding 'JUE' is not rare.

Please do a rom region checker to run the proper machine at starting a megadrive game.

Currently, Mamehub is always running the megadrive with the 'megadriv' driver: "csume64.exe megadriv -cart sor2u" Please run at least by default a 60Hz machine, like the 'genesis' (US) driver or the 'megadrij' (JP) driver: "csume64.exe genesis -cart sor2u" for instance.

Also, a preference order would be nice, for instance: USA (in case of U or unknown flag), then JAP (J), then EUR (E) as last choice.

Here is an informative/example code that can be used as illustrative, found at: http://code.ohloh.net/file?fid=9MWmjgGNwLMjIWLgwLTWqomKlXc&cid=yDo946zlmPg&s=

[code] ...Line 1006... /* from Gens */ if (!memcmp(rominfo.country, "eur", 3)) country |= 8; else if (!memcmp(rominfo.country, "EUR", 3)) country |= 8; else if (!memcmp(rominfo.country, "jap", 3)) country |= 1; else if (!memcmp(rominfo.country, "JAP", 3)) country |= 1; else if (!memcmp(rominfo.country, "usa", 3)) country |= 4; else if (!memcmp(rominfo.country, "USA", 3)) country |= 4; else { s32 i; char c;

    /* look for each characters */
    for(i = 0; i < 4; i++)
    {
      c = toupper(cast(s32)rominfo.country[i]);

      if (c == 'U') country |= 4;
      else if (c == 'J') country |= 1;
      else if (c == 'E') country |= 8;
      else if (c == 'K') country |= 1;
      else if (c < 16) country |= c;
      else if ((c >= '0') && (c <= '9')) country |= c - '0';
      else if ((c >= 'A') && (c <= 'F')) country |= c - 'A' + 10;
    }
  }

  /* set default console region (USA > JAPAN > EUROPE) */
  if (country & 4) region_code = REGION_USA;
  else if (country & 1) region_code = REGION_JAPAN_NTSC;
  else if (country & 8) region_code = REGION_EUROPE;
  else if (country & 2) region_code = REGION_JAPAN_PAL;
  else region_code = REGION_USA;

  /* some games need specific region settings but have wrong header*/
  if (("T-45033" in rominfo.product && rominfo.checksum == 0x0F81) || /* Alisia Dragon (Europe) */
       "T-69046-50" in rominfo.product ||    /* Back to the Future III (Europe) */
       "T-120106-00" in rominfo.product ||   /* Brian Lara Cricket (Europe) */
       "T-70096 -00" in rominfo.product)     /* Muhammad Ali Heavyweight Boxing (Europe) */
  {
    /* need PAL settings */
    region_code = REGION_EUROPE;
  }
  else if (rominfo.realchecksum == 0x532e && "1011-00" in rominfo.product) 
  {
    /* On Dal Jang Goon (Korea) needs JAPAN region code */
    region_code = REGION_JAPAN_NTSC;
  }
}

/* 8-bit cartridge */
else
{
  region_code = sms_cart_region_detect();
}

/* save auto-detected region */
rom_region = region_code;

} else { /* restore auto-detected region */ region_code = rom_region; }

/* force console region if requested */ if (config.region_detect == 1) region_code = REGION_USA; else if (config.region_detect == 2) region_code = REGION_EUROPE; else if (config.region_detect == 3) region_code = REGION_JAPAN_NTSC; else if (config.region_detect == 4) region_code = REGION_JAPAN_PAL;

/* autodetect PAL/NTSC timings */ vdp_pal = (region_code >> 6) & 0x01;

/* autodetect PAL/NTSC master clock */ system_clock = vdp_pal ? MCLOCK_PAL : MCLOCK_NTSC;

/* force PAL/NTSC timings if requested */ if (config.vdp_mode == 1) vdp_pal = 0; else if (config.vdp_mode == 2) vdp_pal = 1;

/* force PAL/NTSC master clock if requested */ if (config.master_clock == 1) system_clock = MCLOCK_NTSC; else if (config.master_clock == 2) system_clock = MCLOCK_PAL; }

/**** ... [/code]

Thank you.

Gitweazle commented 10 years ago

I kind of overlooked this issue. The MESS team lumped every region together in one XML, and not just on the Genesis/Megadrive. In my edited XMLs I had split these accordingly for all systems (for both the official MESS roms and the older rom files, which now reside in the oldhash folder).

Using shortnames is supposed to assure that the game is ran with the correct parameters (such as region), but some (most?) systems are just not complete yet.

MisterTea commented 10 years ago

This is a bug in the MESS softlist, not MAMEHub. All of the interfaces are "megadriv_cart" when some of them should be "genesis_cart". For example, look at this entry that claims to be USA only but still has megadriv instead of genesis. Please fix these entries or file a bug for the MESS team to fix this.

From megadriv.xml:

<!-- Only USA is confirmed -->
<software name="combatca">
    <description>Combat Cars (Euro, USA)</description>
    <year>1994</year>
    <publisher>Accolade</publisher>
    <part name="cart" interface="megadriv_cart">
        <feature name="pcb" value="7100-00002"/>
        <feature name="ic1" value="ACCOLADE, INC 9447 LHR ACCARSG 1994 ACCOLADE"/>
        <dataarea name="rom" width="16" endianness="big" size="1048576">
            <rom name="accarsg.ic1" size="1048576" crc="e439b101" sha1="0c7ca93b412c8ab5753ae047de49a3e41271cc3b" offset="0x000000"/>
        </dataarea>
    </part>
</software>
Gitweazle commented 10 years ago

Ahh, so MAMEHub reads the interface parameter to determine the system command line argument? I can work with that.

MisterTea commented 10 years ago

I'll leave the issue open in case the MESS team or someone here wants to fix it.

byblo commented 10 years ago

Waiting for registration acceptation to post this same bug at MESS reporting bug webpage: http://mametesters.org/

But why not making the workaround i suggested for MAMEHub? I mean, it would take less than one hour to write and test it.

It seems to me the most elegant and durable fix. Thus, messy MESS hashes would not mess with genesis roms refresh rate and proper machine anymore ^^;

I would write it myself, but I don't know nothing about Java. So jumping in the project while not even knowing about it would not be a good idea.

Or maybe it can be done directly at MESS sources? Still need to check this solution.

SonnyJim commented 10 years ago

If there's a problem with MESS, then the MESS devs need to fix it, rather than us using a workaround. You'll find it a massive pain in the rear trying to get them to notice the problem though.

The best way I found was to gather as much documentation on the problem as you can and try and catch someone in #messdev on irc.

byblo commented 10 years ago

The answer from MESS team was pretty cheap: http://mametesters.org/view.php?id=5696 I won't comment admin's anwer which was between captain obvious, quoting me and space void. If they didnt closed the damn topic already, I would have said to the dev that the ORIGINAL machine is the Japanese Megadrive, certainly NOT the european slower 50Hz machine. Thus, they could at least used the japanese megadrive as default console...

I don't know why, but 90% of my feedbacks and bugs report are always minimized or ignored. So, I think im done with wasting my time reporting problems and bugs >_<

MisterTea commented 10 years ago

Gotcha. Well the only other option is for us to fix it ourselves. As I mentioned in this thread, we use the xml file to figure out which machine to run, so the xml file has to be changed to genesis where appropriate.

On Wednesday, September 17, 2014, byblo notifications@github.com wrote:

The answer from MESS team was pretty cheap: http://mametesters.org/view.php?id=5696 I won't comment admin's anwer which was between captain obvious, quoting me and space void. If they didnt closed the damn topic already, I would have said to the dev that the ORIGINAL machine is the Japanese Megadrive, certainly NOT the european slower 50Hz machine. Thus, they could at least used the japanese megadrive as default console...

I don't know why, but 90% of my feedbacks and bugs report are always minimized or ignored. So, I think im done with wasting my time reporting problems and bugs >_<

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/283#issuecomment-55858765.

Gitweazle commented 10 years ago

Shall I split the XML according to region again? Because _genesiscart wasn't recognized. megadriv.xml megadrij.xml genesis.xml

MisterTea commented 10 years ago

Whoops, you are right. Looking at the code, the filename is used for the system and the interface is not used. I can switch to using the interface attribute in the part tag, or we can split the file. If I switch to using the interface attribute, I believe that breaks some other systems.

On Tue, Sep 23, 2014 at 1:49 PM, Gitweazle notifications@github.com wrote:

Shall I split the XML according to region again? Because _genesiscart wasn't recognized. megadriv.xml megadrij.xml genesis.xml

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/283#issuecomment-56560697.

Gitweazle commented 10 years ago

Yeah using interface will become even messier I think. Some interfaces are simply called _floppy_525 or MSX2 are called _msxcart, which will run MSX1.

I'll do the same for SNES & SNESPAL

SonnyJim commented 10 years ago

To me it makes more sense to split them by system XML rather than by interface. On 23 Sep 2014 19:08, "Gitweazle" notifications@github.com wrote:

Yeah using interface will become even messier I think. Some interfaces are simply called _floppy_525 or MSX2 are called _msxcart, which will run MSX1.

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/283#issuecomment-56563715.

MisterTea commented 10 years ago

Good point. So yeah, we'll have to just divide the xml into three then

On Tue, Sep 23, 2014 at 11:08 AM, Gitweazle notifications@github.com wrote:

Yeah using interface will become even messier I think. Some interfaces are simply called _floppy_525 or MSX2 are called _msxcart, which will run MSX1.

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/283#issuecomment-56563715.

Gitweazle commented 9 years ago

There is a problem with splitting up the XML. I will take Megadrive / Genesis as an example.

For genesis to show up in Filter by Machine list and find/run the respective games I need to perform the following actions:

Reason for the bug:

MisterTea commented 9 years ago

This sounds like a bug in MESS.

Cat: can you file a bug against them to fix this? On Mon, Jul 6, 2015 at 5:27 PM Gitweazle notifications@github.com wrote:

There is a problem with splitting up the XML. I will take Megadrive / Genesis as an example.

For genesis to show up in Filter by Machine list and find/run the respective games I need to perform the following actions:

  • Create a genesis.xml
  • Create a genesis subfolder BUG - Have the genesis-only game in BOTH the megadriv and.genesis subfolders.

Reason for the bug:

  • MAMEHub checks XML file name (genesis.xml) and uses it as the system command line argument.
  • MAMEHub looks for the ROM in the folder based on the XML file name (genesis).
  • MESS' shortname method checks the hardcoded default system folder for the ROM when starting the game (megadriv) .

— Reply to this email directly or view it on GitHub https://github.com/MisterTea/MAMEHub/issues/283#issuecomment-119034118.

Gitweazle commented 9 years ago

I fear this is a feature not a bug :)

It is a direct result of the name changes to their XMLs. They lump similar systems and regions together.

In other words: System Command Line Argument <> XML File Name

If I report this I will receive the same answer byblo got: "It is the task of the end user to determine which machine to pick."

Solution: We need an extra row in media.txt that links each system to an XML file. I am currently asking if such a list already exists in IRC #messdev.

EDIT: I will make the list and post it.