don't click here

Gens/GS Milestone 6

Discussion in 'Engineering & Reverse Engineering' started by GerbilSoft, Aug 24, 2008.

  1. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    I've been working on a fork of Gens for the past few months. The main improvements are massive source code overhauls and cleanups, as well as some feature additions.

    The current release of Gens/GS is Milestone 6, and is available here: Gens/GS

    New features coming soon in Release 7:
    • Versioning scheme changed from "Milestone" to "Release" due to several Microsoft fanboys who insist that only Microsoft has the "one true versioning system", and spread lies that Gens/GS was pre-alpha since it used the "Milestone" designation.
    • External plugin support (*.dll/*.so), based on the MDP v1.0.0 specification.
    • Improved Game Genie plugin.
    • "Sonic Gens" plugin, based on a hack of Gens by LOst.
    • "VDP Layer Options" plugin, which lets you disable layers and swap layer priorities.
    • New renderers: EPX, EPX Plus, Super Eagle, Super 2xSaI.
    • Built-in copy of the reverse-engineered 32X firmware by DevSter.
    • Improved joystick support. (The Linux/SDL version now supports up to 128 axes, 256 buttons, and 64 POV hats. The Windows version supports the maximum number that DirectInput allows, which I can't recall offhand.)
    • Redesigned Controller Configuration dialog. It now shows the current configuration for controllers, and it lets you configure one button at a time.
    • Improved Teamplayer/4-Way Play support. (It still doesn't work on all games that support it, but it's better than before.)
    • WAV dumping support has been reimplemented. (It was dropped in the original Gens/Linux due to reliance on Win32-specific APIs.)
    • Two VDP bugs fixed: Zero-length DMA is now correctly handled as 65,536 bytes, and VDP DMA now wraps on 128K boundaries. (The 128K wrap fix isn't perfect, but it's much better than it was before.)
    • ROM History now saves the name of ROM files selected from within multi-file archives.
    • Initial support for the "Palette Select" bit in VDP register 0. If it's cleared, only the LSB for each color component in CRAM is used. Not very useful, but more accurately simulates the actual hardware.
    • SRAM can now be disabled in the Options menu. This fixes Puggsy.
    Planned for Release 8 or later:
    • libcdio integration for improved, cross-platform physical CD-ROM support and BIN/CUE support.
    • mdZ80 port to C.
    • ZOMG savestate format.
    • Complete separation of UI from emulation code, resulting in libgens.so, gens-gtk2, gens-win32.exe, gens-qt4, etc.
    EDIT: Added stuff planned for Release 8 or later.
     
  2. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    Just checked and Gens emulates this bug. Are you sure it isn't emulated or it got removed at some time I don't know? Or there's another sprite priority bug I'm not aware of?
     
  3. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    You actually mentioned it in #retro:

    Code (Text):
    1. <+Sik> See, there's a priority flag for each tile in the plans and each sprite
    2. <+Sik> However, it only works between planes. Sprites are ordered by the chain list.
    3. <+Sik> So a sprite with low priority flag can still appear over one with a high priority flag.
    4. <+Sik> Guess what happens when you have that situation and it's mixed with a high priority in the scroll planes.
    5. <+Sik> Hint: put a green block in Sonic 1 in the overground areas. Put it into the lava so it floats on it. Wait until it collisions with a platform...
    So that bug *is* emulated correctly in Gens?
     
  4. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    Yep, I checked it as soon as I saw the post and it was emulated.

    EDIT: quick way to check if it's emulated, try this:
    http://www.fileden.com/files/2006/12/22/543510/vdpbug.PNG
    Use debug mode to place the green block, push it onto the lava and see what happens =P

    EDIT 2: yes, I know that screenshot is from Fusion, I just wanted to show how it looks with the bug. It does the same thing on Gens, but I wasn't going to make another screenshot just to change the titlebar =P
     
  5. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    Yeah, I just tested it on my Gens codebase and the bug is, in fact, emulated correctly.

    I crossed it off the list.
     
  6. Flygon

    Flygon

    Member
    Okay, I'm definitely going to download this Gens edition if it has overclocking, Megasis's desynchronizing is getting moronic.
     
  7. Sith

    Sith

    The molotov bitch Member
    Glad that I could bring this to your attention. Lots of Gensmade hacks suffer from this.
     
  8. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    Stupid question: what's the cause of that bug? What do those hacks do wrong? =/
     
  9. Uberham

    Uberham

    King Of Oblivion Member
    Could you also Hack in support for ROMS over 4 MB?

    It's just I want to play that Ultimate Mortal Kombat Trilogy hack with a current (ish) version of GENS.
     
  10. Sith

    Sith

    The molotov bitch Member
    Gens doesn't handle vram overwriting properly and does things that are not allowed on hardware.
    Therefore Gensmade hacks don't follow the correct hardware standards and give garbled object gfx on Kega or hardware.
     
  11. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    D'oh, I was asking for the exact technical reason of the overwrite, not why there's a bug in the hacks =P
     
  12. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    UMK Trilogy uses stuff not found on the actual hardware, so I won't be implementing it.

    Specifically, it uses a non-bankswitched ~10MB ROM, which is impossible on the actual hardware. There is the official Sega bankswitching system though, which I think Gens already supports. The official bankswitching system supports up to 32MB ROM, but requires the program to be specifically coded to use it. The only game I can think of that uses this bankswitching method is Super Street Fighter II, which has a 40Mb (5MB) ROM.
     
  13. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    Phantasy Star 4 uses it to access SRAM too, because the ROM is 4MB and there isn't any space for the SRAM address.

    EDIT: fix Z80 bug =P For some reason, if I access the joypads, the Z80 starts running even if I don't send the command (I don't do so because I'm not using it). This leads to another issue that in the end causes the program to crash. This doesn't happen on real hardware.
     
  14. The bug in S2 Delta, S2 Long Version etc. is caused by a DMA of length 0, which apparently does nothing on Gens but screws stuff up on Kega and real hardware. I'm quoting a post of Jman's below which explains the problem and gives its solution:
     
  15. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    Oh, that bug =P

    Fix: check the DMA length after moving each word, not before doing so =] But I'm assuming it emulates the DMA the proper way. If everything is loaded directly, bad luck there D=
     
  16. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    I think I may have located this bug. Can you post a test ROM that will indicate if the Z80 is running after it reads the gamepad?

    Code (Text):
    1. mem_m68k.asm, line 1450
    2.  
    3. xor ecx, ecx
    4. mov ah, [Z80_State]
    5. mov dword [Controller_1_Counter], ecx
    6. test al, 1
    7. mov dword [Controller_1_Delay], ecx
    8. mov dword [Controller_2_Counter], ecx
    9. mov dword [Controller_2_Delay], ecx
    10. jnz short .desactived
    11.  
    12. test ah, 2
    13. jnz short .already_actived
    14.  
    15. or ah, 2
    16. push edx
    17. mov [Z80_State], ah
    Note that it enables the Z80 after reading the controller counters. I'm not sure if this is the correct thing, but a test ROM would help me test this.
     
  17. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
  18. notaz

    notaz

    Tech Member
    32
    0
    6
    It's not a bug, it is a feature. Even SNES behaves like this.
     
  19. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    And how many games took advantage of it? =/

    http://www.joystiq.com/2008/08/21/see-tige...the-jesus-shot/
    I know it's off-topic, but you just made me remind of that. Best example of that phrase ever =P Also reminds me of Microsoft >_>
     
  20. notaz

    notaz

    Tech Member
    32
    0
    6
    There are quite a few. I know Sonic 3D Blast depends on on it, also see your other thread for another example.