Dreamcast Widescreen Hacks

Discussion in 'Sega Dreamcast Development and Research' started by S4pph4rad, Oct 20, 2015.

  1. shengoro86

    shengoro86 Active Member

    Joined:
    Dec 30, 2013
    Messages:
    27
    Likes Received:
    7
    Yeah true. The only reason why I ask is because I thought codebreaker took the region code to define a part of its algorithm for its codes. Thus having different codes for different regions.

    Yeah the Kogami undub is awesome.
    But hey, I'd also like to work on this so let me know if I can help. I already started porting the PAL selector.
     
  2. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    2,517
    Likes Received:
    445
    Feel free to work on it, I'm not the manager here :p I only was intrigued at how I could patch a GDI directly without using Codebreaker as I got a GDEMU and using CB is a bit of a pain with it. I won't have time to check that out for days though, feel free to verify yourself!

    AFAIU, the code is for the PAL version, and Kogami's undub is also based on the PAL version, so there's no issue there.
    Got confused! Code in 1st post is for US version of Shenmue, and PAL of Shenmue II.
     
    Last edited: Oct 21, 2015
  3. shengoro86

    shengoro86 Active Member

    Joined:
    Dec 30, 2013
    Messages:
    27
    Likes Received:
    7
    lol its all good. Yeah I use the USB-GDROM and some usb sticks have audio issues with Shenmue when using both 32 and 64k clusters with a CDI file. I would also like this in GDI format.
    In all honesty, you are better at general hacking then I am so feel free to go ahead :)
    My solution was a bit too complicated anyway. Patching the file directly would be much easier instead of hacking a menu to perform RAM stuffs.
     
  4. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    2,517
    Likes Received:
    445
    Could you please test it by patching offset 0x00130250 (decimal 1245776) of 1st_read.bin to 0x43800000, in NSTC-U Shenmue?
    You can use RebuildGDI to do this easily. You can also patch directly <last-track>.iso, or <last-track>.bin but it this case you got to rebuild the EDC/ECC footer of the corresponding sector.
     
  5. shengoro86

    shengoro86 Active Member

    Joined:
    Dec 30, 2013
    Messages:
    27
    Likes Received:
    7
    I'll see if I get the time on Saturday.
    Thanks!
     
  6. Esppiral

    Esppiral Peppy Member

    Joined:
    Oct 3, 2012
    Messages:
    380
    Likes Received:
    813
    The code should be different for the Pal version of Shenmue?
     
  7. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    2,517
    Likes Received:
    445
    Yes, as the executable is most likely different, ever so slightly.
     
  8. Esppiral

    Esppiral Peppy Member

    Joined:
    Oct 3, 2012
    Messages:
    380
    Likes Received:
    813
    Absolutely! There is a lot of Dreamcast games that would benefit massively from widescreen patches.
    RE Code Veronica
    Le Mans 24h
    Dead or alive
    Skies of arcadia
    Sega xtreme sports
    Head Hunter
    Etc....

    How can I port the code to the pal version of Shenmue? Also I would appreciate to know how did you manage to find the values needed for the 16x9 aspect ratio :)
     
    Anthony817 likes this.
  9. yzb37859365

    yzb37859365 Rapidly Rising Member

    Joined:
    Jul 14, 2013
    Messages:
    98
    Likes Received:
    51
    great!!

    I am add jap

    Shenmue - Ichishou Yokosuka (JP) (SEGA Enterprises) (1999) [HDR-0016] [497-4365-50016-0]
    HDR-0016 (Disc 1) [AC4D] [J] [0799810] [HDR-0016] [19991122] [V1.007] [1M]
    0222E8A0 43800000



    Shenmue (EU) (2000) [MK-51059-50] [506-0004-76055-8]

    02231EF8 43800000



    Shenmue II (JP) (SEGA Enterprises) (2001) [HDR-0164] [497-4365-50179-2]

    0230D67C 43800000



    What's Shenmue (JP) (SEGA Enterprises) (1999) [610-7179]

    0220BB68 43800000




    Crazy Taxi 2 (JP) (SEGA Enterprises) (2001) [HDR-0159] [497-4365-50159-4]

    022FBBD0 43800000




    Dead or Alive 2 (Limited Edition) (JP) (Tecmo) (2000) [T-3601M] [496-0677-01001-5]
    But I think there is a problem with the characters.
    022FBBD0 43800000



    F355 Challenge (JP) (SEGA Enterprises) (2000) [HDR-0100] [497-4365-50100-6]

    This game can choose option inside




    Fighting Vipers 2 (JP) (SEGA Enterprises) (2000) [HDR-0133] [497-4365-50133-4]

    023D3AF0 43800000


    Outtrigger (JP) (SEGA Enterprises) (2001) [HDR-0118] [497-4365-50118-1]

    0283E284 43800000



    Power Stone 2 (JP) (Capcom) (2000) [T-1218M] [497-6219-45419-3]

    02849AA0 43800000


    Virtua Fighter 3tb (JP) (SEGA Enterprises) (1998) [HDR-0017] [497-4365-50002-3]
    Media [GD-ROM] [!] - [2M]
    02199FB0 43800000





    Zombie Revenge (US) (Sega of America) (1999) [MK-51038]

    02948058 43800000
     
    Last edited: Oct 22, 2015
  10. S4pph4rad

    S4pph4rad Site Supporter 2015

    Joined:
    Nov 28, 2014
    Messages:
    130
    Likes Received:
    99
    I think if someone was really clever, they could use the area to the left and right of 640x480. The SDK appears to have a method called njSetBorderColor() which for some reason isn't in the documentation but is used in the samples. I think this changes the color of the extra area, but every game just sets it to black. My TV actually displays the VGA output "correctly" in that there is black on both sides. I had to manually change the "Scale" setting on the TV to get it to fill.

    This ended up being pulled off via brute force. I knew I needed to find the view matrix in memory and just change it so it could scale different horizontally. I wanted to do an actual disassembly, but I lack a disassembler that supports SH4 and the only one I know of is IDA, which I don't want to buy. So I did what some people do to find widescreen codes on PS2.

    I searched for every instance of floating point 1.0 (0000803f in hex in Little Endian) in memory. There are less than 300 results. I would change results a bunch at a time until I saw the screen change. Most changes do absolutely nothing. I found 3 values this way that had a visual effect. Two of them controlled the horizontal and vertical size of the clock in the upper right corner of the screen. The third caused the entire screen to zoom out when I changed it to 1.33. This value was the most interesting. There were other floating point values near it in memory, (which were not set to 1.0) so I played with each one of those until I found the ones that controlled horizontal and vertical aspect size. I believe what I found was the view matrix I was looking for, since all of the values modify the rendering in some ways. (You can pan the camera, scale the screen, etc.)

    This approach isn't too difficult, and it's probably quicker than an actual disassembly when it works. The only issue is the one I mentioned in my first post, it doesn't modify the logic that the game uses to decide when something leaves the screen so smaller objects on the sides and pop-in/out. So the game isn't really sending any additional data to the PowerVR that it wasn't already. I haven't noticed any new lag in Shenmue II but I haven't done a significant amount of testing yet.

    Regarding some of the later questions. The "02" code type is a 32-bit write, you're correct that the last 3 bytes of the code correspond to the memory address. I really only needed to change one byte, but decided it was more proper to have the code replace the entire float. I don't know if this address is actually part of 1st_READ.BIN or not, that would be pretty easy to verify by using an emulator and looking at the data in memory to see if it matches.

    On a side note, I would've posted this on Shenmue Dojo, but I was banned there about 12 years ago for criticizing LanDC. You can read about it in his words here:
    http://www.shenmuedojo.net/forum/viewtopic.php?f=2&t=10698&p=286883&hilit=Sappharad#p286883
    I won't comment on the situation much more than what he has there, although I think our conflict was about him not being able to use command line tools rather than about hex editing.

    Here are two videos captured from hardware with a shaky camera for those wanted them.
    Widescreen:
    Original:

    This is not the correct address. The original value that you change should be 0000A043. It will need to change to 00008043. (The value is reversed in the code because it's a 32-bit little endian)
    I see a handful of those in 1ST_READ.BIN, I'm going to take a break on this until the weekend but if you don't find the correct one in a few days I can take a look then.

    Awesome, thank you! When we get a lot of these, maybe I should turn the first post into a list of Widescreen codes that people have made?
     
    Last edited: Oct 21, 2015
  11. Anthony817

    Anthony817 Dauntless Member

    Joined:
    May 12, 2010
    Messages:
    711
    Likes Received:
    161
    Yeah this should be a place to discuss all widescreen hacked games not just Shenmue. Thanks for the videos.
     
    Esppiral likes this.
  12. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    2,517
    Likes Received:
    445
    Could you check for the four bytes dec(32768) bytes before that offset? Maybe I was confused with the address of the ip.bin.
     
    Superrayman3 likes this.
  13. Ziming

    Ziming Member

    Joined:
    Sep 24, 2014
    Messages:
    5
    Likes Received:
    1
    LanDC rarely frequents the the dojo forums now, and is neither a moderator or admin. Any conflicts you had with him back then are of no consequence now. If you have a account at our current forums I can help unban it.
     
  14. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    2,517
    Likes Received:
    445
    It should be 0x220250 for Shenmue 1 US, I had a brain freeze.
    0x30186C for Shenmue II PAL and 0x29D67C for Shenmue II JP.

    I have not verified this.
     
    Last edited: Oct 22, 2015
  15. IlDucci

    IlDucci Site Supporter 2015

    Joined:
    Aug 24, 2011
    Messages:
    46
    Likes Received:
    12
    That widescreen video shows lesser out-of-screen artifacts than the standard emulation ones (Check the people that show up after the first boat shots). Which is waay much better.

    Old emulated widescreen:
     
    Anthony817 likes this.
  16. Esppiral

    Esppiral Peppy Member

    Joined:
    Oct 3, 2012
    Messages:
    380
    Likes Received:
    813
    Can someone port it to the pal version of Shenmue? T_T
     
  17. wombat

    wombat Site Supporter 2011,2013,2014,2015

    Joined:
    Mar 14, 2004
    Messages:
    2,571
    Likes Received:
    235
    Great progress you made yzb37859365, there are definitely a few games in that list I would gladly play in 16:9! Important to note, F355 Challenge has indeed a built-in 16:9 mode, however when using VGA this mode gets disabled!
     
  18. Giorgio

    Giorgio Member

    Joined:
    Feb 2, 2015
    Messages:
    6
    Likes Received:
    3
    Have you tried the following?
    Source page: http://www.boob.co.uk/devtools.html
    Source page: http://www.ludd.luth.se/~jlo/dc/
     
    S4pph4rad and Anthony817 like this.
  19. SiZiOUS

    SiZiOUS Rapidly Rising Member

    Joined:
    Mar 27, 2009
    Messages:
    76
    Likes Received:
    48
    Yes! This is really a nice work. Thank you for sharing!

    If I remember well, Shenmue 1 isn't loaded at the standard address (0x8C010000) but at 0x0c010000. This'll impact your offset calculation. I need to check on my tools to verify the right address but I think it's this one.
     
  20. Blashyrkhmr101

    Blashyrkhmr101 <B>Site Supporter 2014</B>

    Joined:
    Sep 10, 2013
    Messages:
    170
    Likes Received:
    11
    Thank you to yzb37859365 for adding What's Shenmue? and Dead or Alive 2 (LE) codes, I just tried out Shenmue I NTSC-U and it works phenomenally despite making it seem like Yokosuka decided to go on a diet.
     
    Anthony817 likes this.

Share This Page