Dreamcast Widescreen Hacks

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

  1. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,034
    Likes Received:
    891
    I meant inserting custom code into it, seemlessly. The idea would be to apply the widescreen patch in memory after the binary is executed, to have a widescreen patch effectively applied, but without the problems S4pph4rad explained with the camera.
     
  2. yzb37859365

    yzb37859365 Spirited Member

    Joined:
    Jul 14, 2013
    Messages:
    187
    Likes Received:
    124
    @-=FamilyGuy=-
    Some games are written like this, and I'm usually inserted before RTS

    mov.l @(h'1E4,pc), r5 ; [0C1D38B8] = dword_C2A1ED4
    mova @(h'1E0,pc), r0 ; [0C1D38B4] = h'3F000000
    fmov.s @r0, fr5
    mov #4, r0
    fmov.s @r5, fr3
    fmul fr5, fr3
    fmov.s fr3, @r4

    write fr3 = 0x43a00000
    r4 = 0x0c230250


    PS: I used the WinHex to manually enter the assembler instruction. T_T
     
  3. S4pph4rad

    S4pph4rad Site Supporter 2015

    Joined:
    Nov 28, 2014
    Messages:
    140
    Likes Received:
    114
    Not feasible. What we're doing is just the equivalent of changing the lens in a camera. 2D games don't have a camera, they just say "draw this here". You'd have to change the logic of the game itself to pull something like that off, and it's not realistically worth the effort to hack a game on that level.

    It's not perfect, (especially all of the FR registers being wrong) but it was so nice to be able to set breakpoints and step through the execution. You can do "bp w ####", "bp x ####", and "bp r ####" to set write, execute, or read breakpoints. "db ####" will switch the memory viewer to the address you specify. "step" will step, F5 will pause or resume.

    That version is also pretty old, and it doesn't work with some games like Shenmue 2. But it was very helpful to me.
     
  4. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,034
    Likes Received:
    891
    First, thanks for the answer!
    But you'll have to dumb it down a bit for me to understand :p
    This is assembly code, and it seems to take values from some addresses (h'1E4,pc and h'1E0,pc), put them into registers, put those registers into floating point registers and do a multiplication then put the result in another register and write it to memory at the address 0x0c230250.

    You tell me I should convert this to machine code using a sh4 assembler (or by hand like it seems you did), and input it into the 1st_read.bin? Where should I insert it?
     
  5. yzb37859365

    yzb37859365 Spirited Member

    Joined:
    Jul 14, 2013
    Messages:
    187
    Likes Received:
    124
    @-=FamilyGuy=-
    Please upload a Shenmue 1st file, I can try to write an example, you can have a look
     
  6. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,034
    Likes Received:
    891
    I'm reinstalling my system right now so I only have access to my phone, if someone else would upload it for you I'd appreciate it!

    [Edit] IIUC the first part is the asm code, and the two last lines what it does? If that the original code? Why do they put #4 in r0? (Is #4 sign extension of 4?)
    So the patch would be to modify the code so that fr3 is 438e38e4 before moving it to memory, or adding an instruction to add it to memory after that snippet? Like "mov.b 0x438e38e4 @r4"? We might have to load the value from somewhere though? Won't we have the camera problem S4ph talked about earlier?
     
    Last edited: Oct 26, 2015
  7. Esppiral

    Esppiral Gutsy Member

    Joined:
    Oct 3, 2012
    Messages:
    495
    Likes Received:
    1,041
    Yup!
    [​IMG]
    [​IMG] [​IMG] [​IMG] [​IMG]
    [​IMG]
     
    Anthony817 and yzb37859365 like this.
  8. yzb37859365

    yzb37859365 Spirited Member

    Joined:
    Jul 14, 2013
    Messages:
    187
    Likes Received:
    124
    @S4pph4rad thank you ,I KONW......

    @Esppiral can you write Memory address?

    thank you

     
  9. shengoro86

    shengoro86 Active Member

    Joined:
    Dec 30, 2013
    Messages:
    27
    Likes Received:
    7
    I'm dropping off the projects as my work is redundant now. Also, do not have the time now as I have to move to japan.
     
  10. Esppiral

    Esppiral Gutsy Member

    Joined:
    Oct 3, 2012
    Messages:
    495
    Likes Received:
    1,041
    CODE VERONICA NTSC USA
    02329E40----3F400000

    CODE VERONICA PAL SPANISH
    0232A3A0----3F400000

    VIRTUA FIGHTER 3 PAL
    0219d718----43700000

    BLUE STINGER
    022D9CA4---3F400000

    COOL BOARDERS
    0219C1BC----3F8CCCCD
    021600C8----3F400000

    SOUL CALIBUR PAL
    022D6138---3F400000

    SPACE CHANNEL 5 PART 2 NTSC J
    0214D3E0---3F400000

    DAYTONA USA-NTSC USA
    021FC6D0----43700000
     
    fafadou, megavolt85, zouzzz and 2 others like this.
  11. wombat

    wombat SEGA!

    Joined:
    Mar 14, 2004
    Messages:
    2,671
    Likes Received:
    319
    @Esppiral that is so cool! My TV is actually the 21:9 Philips model, would be quite epic to finally play some games which use the whole screen! Now I'm used to playing games in the size of a postal stamp haha.
     
  12. Esppiral

    Esppiral Gutsy Member

    Joined:
    Oct 3, 2012
    Messages:
    495
    Likes Received:
    1,041
    To make the games 21x9
    Change
    16x9-43700000 to 21x9 43300000

    16x9-3F400000 to 21x9 3F100000
     
    Rocky5 and wombat like this.
  13. Rocky5

    Rocky5 Site Supporter 2015

    Joined:
    Jan 17, 2014
    Messages:
    524
    Likes Received:
    95
  14. Rocky5

    Rocky5 Site Supporter 2015

    Joined:
    Jan 17, 2014
    Messages:
    524
    Likes Received:
    95
  15. S4pph4rad

    S4pph4rad Site Supporter 2015

    Joined:
    Nov 28, 2014
    Messages:
    140
    Likes Received:
    114
    # plus a number is usually syntax to load a hard-coded value into a register. SH4 instructions are 2 bytes long, so you're fairly limited in what you can do. I'm guessing (I don't have the instruction set document open) that you can only load an 8-bit value with the mov instruction. You can either move a hard coded 8-bit value, or to load something bigger you use one of the relative mov instructions. (For example, loading from a memory address in another register, or load from an address relative to the current code executing. For a 32-bit value, since they're 4 bytes each you can stick a value up to 4*256 bytes away in memory and load it up with the appropriate instruction.)

    Anyway, the #4 would make more sense if you saw the rest of the code in that area. They actually move #8 into the same register later on, and I think #C as well. The area it's writing to a part of a struct (or an array) so they're doing the equivalent of start, start+4, start+8, to populate various values inside the struct.

    Regarding the camera problem, It's possible that one of the registers I used was used for something else later and I didn't put it back how it was supposed to be. Not positive though, I lost the changes I made when I ran chkdsk on Sunday.
     
  16. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,034
    Likes Received:
    891
    Could we simply insert code there? Literally offsetting the rest of the file or would it break it? (I think it would) There's a lot of blank data in the bootbin, so maybe we could use that space to redirect our custom instructions?

    Could you recommend a disassembler and assembler?
     
  17. yzb37859365

    yzb37859365 Spirited Member

    Joined:
    Jul 14, 2013
    Messages:
    187
    Likes Received:
    124
  18. Rocky5

    Rocky5 Site Supporter 2015

    Joined:
    Jan 17, 2014
    Messages:
    524
    Likes Received:
    95
    its asking for a decryption key :\
     
  19. yzb37859365

    yzb37859365 Spirited Member

    Joined:
    Jul 14, 2013
    Messages:
    187
    Likes Received:
    124
  20. Esppiral

    Esppiral Gutsy Member

    Joined:
    Oct 3, 2012
    Messages:
    495
    Likes Received:
    1,041
    Is any one else making widescreen pathces?
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page