Sega Mega Drive Commercial emulator in PS2

Discussion in 'Sony Programming and Development' started by AKuHAK, Jul 1, 2013.

  1. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Long time ago I was searching for commercial emulators at PS2 console (like POPS). And I was found one. It is Sega Mega Drive emulator which is included in Sonic Mega Collection Plus. In fact it is full emulator - I was tested in PCSX2 such a games like Ultimate Mortal Kombat 3, Castelvania Blood Haven, Rock'n'Roll racing (I mean 2-player game). All these game is running perfectly - no lags, no freezing, good fps, all screen is visible. You can save-load game in any moment, 2-player game functions normally, soft reset is working, 3 pad configurations (x,y,z is working). So if this stuff can be hacked - it will be more popular neither pgen (cause game compatibility is bigger).

    But of course there are some problems. Game roms is packed and crypted (yea baby) in such a *.cpt files.
    Or maybe there can be such a way for some mini code injection that ... mmm ... for example... when you press some button combination it just copy some rom from disk into specific memory area ( memory address is static). All that you need - to make soft reset in the game and you will be able to play this new game.

    links can be found at "pastebin SegaMegaCollectionPlus"

    It contains very stripped "Sonic Mega Collection +" image. Some other cpt files can be found in the "Sonic Gems Collection". I also include crypted roms from "Sonic Mega Collection +" released in GameCube. You can replace any cpt file with any other and it will work.
    Game elf using some black magic recognizes your console region (Us, Europe or Japan) and depending on it launches roms from appropriate location (mdrom/mdrom_eu/mdrom_us). In fact some games is similar :) For example Sonic3D is fully identical in all three folders but Sonic3 alters exactly one byte (region U, E or J). Emulator region also changes according your console version. So you need game roms according your region.

    Crypted image size is the same as decrypted. First 64bytes in crypted and decrypted image is similair so I assume it is a key (or at least part of key). Last 0-7 bytes of CPT file are uncrypted.

    I cannot test roms bigger than 4Mb cause Sonic3D (exactly 4Mb) is the biggest game. Other limitation is that there is no way for using multitap and that there is only 3 different pad configurations (and no MODE button support). One more limitation - it is DVD size (more than 900Mb) so we need dummy file for running it.

    If you want test your own rom you have to launch this DVD in the pcsx2, start some game (the best variant Sonic3D), press R2 in game (pause menu), open some hex editor, open process pcsx2, go to address 0x20b2dd40, paste your own rom and press "Game Title" in the game.

    P.S. There is also fully working Sega Master System emulator.
     
    emuler and AlGollan84 like this.
  2. pool7

    pool7 Site Supporter 2014

    Joined:
    Mar 4, 2008
    Messages:
    1,281
    Likes Received:
    152
    Great info! I have Sonic Mega Collection Plus for PS2, but never bothered looking at the disc contents...
     
  3. szczuru

    szczuru Spirited Member

    Joined:
    May 12, 2010
    Messages:
    115
    Likes Received:
    0
    Another "maybe emulator" is i think in "NAMCOllection". (PSX Emu).
     
  4. krHACKen

    krHACKen #CNNisISIS

    Joined:
    Oct 24, 2012
    Messages:
    613
    Likes Received:
    453
    Namcollection games are ported, not emulated.
     
    AlGollan84 likes this.
  5. LocalH

    LocalH Spirited Member

    Joined:
    Sep 2, 2007
    Messages:
    135
    Likes Received:
    13
    I wonder if that's the same Genesis emulator used in Sega Genesis Collection? If so, or even if not, SGC might be another attack vector.
     
    Last edited: Jul 1, 2013
  6. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Sega Genesis Collection is also ported (for example it supports 480p - do you know anything about 480p emulation?). As I say I checked almost all titles.

    There is 3 ways that I was see in PS2: full porting as all games from NamcoCollection or Sonic CD from Sonic Mega Collection Plus; full emulation as in Bishi Bashi 3 or Genesis games from Sonic Mega Collection Plus or such a called "emulation-for-one-game".
    "Emulation-for-one-game" - it is very strange way for getting titles working in PS2. First of all "they" take original rom, or memory dump or cd image (depending on what system is emulated). Next step: "they" emulate this game without (!) sound and got 2 files: game elf and *.SR file which contains original rom, some pictures (for pause menu and so on); next step: "they" convert all sounds in PCM wav format and insert them into SR file; next step: "they" insert hard links for sound into elf file and test it; final step - they remove all bugs from this castrated version of game.

    For example I released Mortal Kombat Arcade Hack Kollection for PS2 because it was possible to alter game roms in the SR files. But you can understand: first you can alter only hacks exactly for corresponding version of game (I mean where is changed one or two bytes :) ), next the size of game is enormous (can you imagine how much space can be taken for PCM files?).

    So the only useful way - to hack emulation in Sonic Mega Collection Plus.
     
    Last edited: Jul 2, 2013
  7. Lum

    Lum Officer at Arms

    Joined:
    Sep 30, 2010
    Messages:
    3,234
    Likes Received:
    43
    Sonic Mega Collection Plus has a 480p scaler too. Progressive mode is mentioned right on page 2 of its US PS2 booklet.
     
  8. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Oh now take one more look into Sega Genesis Collection - CZ files - it is just simple zlib packed files. But nevermind limitations still the same.
     
    Last edited: Jul 2, 2013
  9. l_oliveira

    l_oliveira Officer at Arms

    Joined:
    Nov 24, 2007
    Messages:
    3,889
    Likes Received:
    249
    Namco was a reasonably organized corporation which kept sources and designs from all of their projects. The other day the guy who created Puckman/Pacman was showing his designs and sketches from back then on a famous site. I don't remember which site was it.

    Funny how other companies can't do the same thing... lol (SEGA ? lol)
     
  10. krHACKen

    krHACKen #CNNisISIS

    Joined:
    Oct 24, 2012
    Messages:
    613
    Likes Received:
    453
    I'm disappointed that NAMCO didn't convert their classic arcade racing games to PC. Especially for Rave Racer which was announced for PowerVR then cancelled.

    [video=youtube_share;aBuGwrWP-s4]http://youtu.be/aBuGwrWP-s4[/video]

    And because there are tons of Ridge Racer and Tekken fans not just in Japan but worldwide, it's sad that namCollection was released exclusively in Japan. At least, western RR fans have RR Hi-Spec/Turbo:redface-new:.
     
  11. Johnny

    Johnny Gran Turismo Freak and Site Supporter 2013,2015

    Joined:
    Mar 14, 2004
    Messages:
    6,232
    Likes Received:
    404
    Namco should port lots of their arcades to PSN and XBLA. A compilation disc would be awesome as well.
     
  12. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Maybe someone know how at least make it posssible to run from CD not from DVD?
     
  13. LocalH

    LocalH Spirited Member

    Joined:
    Sep 2, 2007
    Messages:
    135
    Likes Received:
    13
    No idea. I do know there's a big dummy file on the disc, but even after removing it and remastering (just to see the size difference, and to experiment with it and see if it works directly without the big file, which I have yet to test) the rest of the retail contents are 1.60GB. About 680MB of that is taken up by .SFD video files in /MOVIE, however, and it may be possible to remove them with no ill effects (I know from my efforts hacking Guitar Hero 2 that, if a .PSS video is missing, the game doesn't crash but just skips the video, perhaps the same is true with SMC+). There are also 300MB of .SFD files in /MODE_GS, but those I think are background video for the menus and thus at least some of them would need to be kept so the menu doesn't crash (although might be worth testing, it's possible that missing menu videos may display with black behind them instead of crashing). There are also about 450MB or so of .AFS files (images?) within the /COMIC and /MANUAL directories, which one could probably remove with no ill effects (unless one actually tried to look at the removed files).

    I noticed when taking a cursory look through the files, that there seems to be both an EE component (in the main ELF) and an IOP component (in /MODULES/MSIS_IOP.IRX). Based on that filename and a string found in the main ELF, it looks like it's a PS2 port of the old emulator MEGASIS. Doesn't look like there's source available for it, or I'd almost suggest re-porting it unofficially. Regardless, I'd almost guarantee that the IRX would be required for unofficial use.

    Not sure if it would work, but one could possibly use a similar method to doing CD-to-DVD patching, but in reverse, to make the game accept CD media. That may also fall flat if the game references files by LBA instead of via the filesystem.

    Edit: I did a quick Google search for "MSIS_IOP.IRX", and found another game that looks like it has the same emulator within and may be easier to make use of - Phantasy Star Generation 2, which allows playing of the original Phantasy Star II MD version. I don't have the game right now to inspect the files, but I will look into acquiring it. If you do look into this game, here are some notes about file formats, if they help. Since this is part of the Sega AGES 2500 collection, it'll be Japanese only, but I think the game is already on a CD, so that may help as well.
     
    Last edited: Jul 3, 2013
  14. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Ok thanks to LocalH, krHACKen and guys who are translating "Phantasy Star Generation 2" I can represent you working SMD emulator which is ripped of sega ages volume 17.

    Take a look at this, password :SEGA.
    As example there is injected ultimate mortal kombat 3
    Limitations: rom size 4Mb, no SRAM support, I don't know if there is working save/load :) all menus japanese , no way for rearranging buttons...

    It iso image which can be run from OPL.

    So enjoy and try it :)
     
    Last edited: Jul 4, 2013
  15. LocalH

    LocalH Spirited Member

    Joined:
    Sep 2, 2007
    Messages:
    135
    Likes Received:
    13
    Damn good work, AKuHAK! Glad I was able to help find a game that was small enough to do this with. I did notice that the normal PSG2 title screen appeared, which I expected for a POC, and it had corrupted menu options. The correct one to choose is the third one, which would normally launch the original Phantasy Star II. I also tested injecting a homebrew ROM I made years ago and it worked fine, outside of not honoring my backdrop changes (but that's fine, I didn't code it in the way that most games would use interrupts, I simply NOP'd until the desired scanline, in the early-80s-C64 style). Can't wait to see what you might develop this into.
     
  16. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Found weird bug with second controller. Button A is placed on the first controller :) So when you press "Square" on the first controller A is pressed on both controllers.
     
  17. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    Tested one more emulator from Sega Genesis Collection. First of all it is fully muted (cause sound emulation module doesn't exist). And the second thing - it has the same issues as pGen :disgust: Rock n roll racing doesn't have second screen when playing in 2-player mode, ultimate mortal kombat 3 crashes in any battle with game over screen, no support for 10mbyuted roms.

    Why it is better then emulator from sega ages volume 17 - it is built-in screen-rate change (from PAL to NTSC), built-in progressive scan support, it has support for more then 4mb roms, has save/load function, screen reposition and nice menu :D

    Here is links and easy tutorial for injecting games.
    -------------------------------------------------------------------
    Anyway the best solution - of course Sega Mega Drive Collection Plus Hacking. But still encryption/decryption is the wall...
     
  18. LocalH

    LocalH Spirited Member

    Joined:
    Sep 2, 2007
    Messages:
    135
    Likes Received:
    13
    I wonder if any of the other Sega AGES 2500 games would be worth looking at as well. I know that vol 25, Gunstar Heroes Treasure Box, has three different games selectable (Japanese, overseas, and the prototype), and according to some reviews I'm looking through, there are some resolution and filtering settings that don't exist in PSG2. Sega AGES Vol 32 is a Phantasy Star Complete collection and also has three MD games selectable (Phantasy Star 1 was of course a MkIII/MS game). Vol 20, Space Harrier Collection, is where Sega apparently improved their emulator (which may be the same or a closer version to that found in SMC+). I'm going to take a look at vol 25 later and see if the ROMs are still unencrypted like they are in vol 17.

    I hope to see you find a suitable game to hack on and produce something like your MK Arcade Hack Kollection. Bonus points if you can make a front end to load ROMs from USB and put them in memory so that the emulator will run the chosen game, or a tool to "automatically" build an ISO with the desired game(s) injected into it.

    Edit: Took a look at GHTB. It appears that all the assets are contained in a file called DATA.CCF. This file seems to have a file table at the beginning, seems fairly straightforward format. Each file entry appears to take 32 bytes, of which the first 24 contain the filename, the next dword contains what appears to be the offset within DATA.CCF, followed by a dword that I can only assuming is the length of the file. The first file listed is alien_soldier.shr at offset 0x3000, length 0x15699C. The ROM seems to have a different header (begins with SHR instead of CM) and also looks to be compressed, possibly with the same algorithm that PSG2 used. The files do not seem to be encrypted as with SMC+. As the .CCF file table seems fairly straightforward, it may be possible (you would know better as you have actual PS2 programming skill) to isolate the emulator and, instead of injecting files into the DATA.CCF, rather rebuilding it with new files and accurate filenames (so, for example, your testing of UMK3 wouldn't be internally referenced as "alien_soldier.shr"), or possibly making the emulator read outside of the .CCF archive.
     
    Last edited: Jul 5, 2013
  19. AKuHAK

    AKuHAK Spirited Member

    Joined:
    Jul 25, 2012
    Messages:
    174
    Likes Received:
    48
    OK I tested emulation from Sega Ages vol. 32 and there is some good news. This emulator has very much built in options: you van change emulator region from PAL to NTSC natively, you can rearrange any button, you can zoom screen and change its position; you can change 4 game video modes: 480i, 240p, 480p and 480p scanline; deflicker, intensity, texture smoothing... And there is just unencrypted roms (just replace phantasy star 4) :D And there is very good debug output which show you every error and which module caused it.

    But problems: maximum rom size 3.1 Mb (no way for mortal kombat 3), and still the same bugs with 2-player game in Rock'n'Roll Racing, some games are Veeeeery slow. In fact it is very slow and compatibility is very low. But 480p :p
     
  20. blueheaven

    blueheaven Spirited Member

    Joined:
    Aug 9, 2012
    Messages:
    108
    Likes Received:
    11
    I'm sure you know Rave Racer can be played from PC ;)
     

    Attached Files:

Share This Page