Page 19 of 70 First ... 91819202969 ... Last
  1. #181
    Join Date
    Sep 2010
    Posts
    157
    OK, here is a version with a 'Quit ROM shortcut'. As always, the binary and the source are included.

    This kinda negates my earlier promise not to release any more unsubstantial updates, but the inability to quit a ROM and having to manually exit the emulator everytime using Quit Game in the XMB surely irritated the crap out of everyone, so there.

    ROM Quit: Press R2 + L2 simultaneously to go back to the ROM browser menu.

    This shortcut will likely change as more features are added.

    SNES9x-PS3 Squarepusher Build 4.2.1 (with Source)

    http://www.ps4news.com/forums/attach...chmentid=21802

  2. #182
    Join Date
    Sep 2010
    Posts
    157
    OK, noticed another problem with this ROM switching method that I've implemented in build 4.2.1 - after having quit a ROM and selected a ROM for five times or so, eventually the next ROM you will load will just render a black screen and you'll have to reset the PS3.

    At first I thought that maybe I should 'quit' Snes9x properly and deallocate all memory assigned to it. So after going out of the 'is_running' loop, I called the following Snes9x callbacks:

    Memory.Deinit();
    S9xGraphicsDeinit();
    S9xDeinitAPU();

    I also read here that after you've called Memory.LoadROM, you should call S9xReset() after that:

    http://www.hackchina.com/en/r/70799/HOW2PORT.TXT__html

    So also added that. But it did not seem to fix the problem.

    I figured that maybe there is something in the display code that is not properly handling this reinitialization of the screen.

    I really hope Eiz will come back at some point and look at the state the emulator is now in and perhaps revisit the display code and all the other parts that would need some work - I'm mainly building on his code at the moment.

  3. #183
    Join Date
    Dec 2008
    Posts
    218
    squarepusher2 - You the man, great work with all the updates...

    +REP for all your work so far...

    Ps, your exit function L2+R2 works flawlessly

  4. #184
    Join Date
    Jun 2006
    Posts
    59
    squarepusher2, thx, work nice, but have black screen problem

  5. #185
    Join Date
    Sep 2010
    Posts
    157

    [Register or Login to view code]

    The following changes has been made in rom_menu:

    rom_menu



    [Register or Login to view code]

    start_snes9x


    [Register or Login to view code]

    Then near the end of the main loop, I run an infinite loop where the mode switching will occur. The code is basically trapped inside one of either functions (rom_menu or start_snes9x) as long as no user input takes them out of it (in-game, this is achieved by pressing L2 + R2, which sets mode_switch to 0 and is_running to false, and will return the code from the start_snes9x body back to the infinite loop inside main().

    Main


    [Register or Login to view code]

    S9Exit callback

    Was previously empty, now takes care of the deinitialization process. Not sure if it is actually called though - or whether the 'black screen' even constitutes an error occurring in Snes9x, or whether it's the display code.


    [Register or Login to view code]

    The following changes has been made in rom_menu:

    rom_menu
    [/quote]

    Forgot to add the following change:


    [Register or Login to view code]

    The following changes has been made in rom_menu:

    rom_menu
    [/quote]

    Forgot to add the following change:


    [Register or Login to view code]

    Slight typo there - S9xExit(); should not be in there since it should not be called before we've got the chance to do the Memory.SaveRAM call.

  6. #186
    Join Date
    Apr 2010
    Posts
    709
    this actually works quite well.. sound, video everything.. played a game i haven't played in about 10 years.

    <3 cheers to the guy who made this

  7. #187
    Join Date
    Sep 2010
    Posts
    157
    Just wanted to inform you guys on the latest build:

    * It crashes on a black screen after loading the fifth ROM using the Quit ROM feature (L2+R2 in-game). So, basically, after having loaded the fourth ROM using the Quit ROM shortcut button (L2+R2) - if you want to play another ROM, click on the PS button and select Quit Game - then, restart the emulator.

    If you don't, the fifth ROM will crash the emulator and you will have to reboot and hook up your PSgroove device to the machine to get it back into Jailbreak mode. Major hassle, and it can be easily avoided at the moment this way until I've figured out what is going wrong here.

    I think this is some kind of bug with the RSX and the libgcm display code - it's really hard to debug this stuff without Sony's own debugger setup - but perhaps output some kind of debug string to try to pinpoint at least where it goes wrong. It doesn't help either that libGCM basically assumes you have a total understanding of how the RSX operates - and therefore doesn't permit any kind of screwups. I don't think any homebrew programmer at the moment is at the point where they can honestly say they understand totally how the RSX needs to be operated using libGCM, and all the things that can potentially go wrong.

    In that sense, I think switching to PSGL would be preferable because there are less opportunities to screw up.

    EDIT: Just knocked up a quick (and ugly) hack that will simply exit the emulator and return you back to the XMB after having loaded the fourth ROM. Of course, the real priority is getting this issue sorted out - perhaps eisz might want to help out on this one. In the interim, this is better than it simply crashing on a black screen.

    SNES9x PS3 Build 4.2.2 (with source)

    CHANGED: Exits the emulator and returns back to the XMB after having loaded the fourth ROM to prevent black screen upon trying to load the fifth ROM from the ROM browser menu.

    cell.cpp


    [Register or Login to view code]


    [Register or Login to view code]


  8. #188
    Join Date
    Sep 2010
    Posts
    157
    Coincidentally, I think I have implemented something that might count as an improvement, video-wise.

    I was noticing on certain games like Donkey Kong Country - when the screen was really moving fast, that it was still skipping over a frame or so even though V-Sync is enabled.

    Byuu himself (bsnes creator) commented on the PS3news forum that, in order to get perfect video/audio synchronization, there are a couple of hurdles to overcome - and he says it all comes down to the discrepancy between the SNES's video output frequency vs the PS3's.

    [Register or Login to view code]

    So, what this does is the following - do two vertical blanks at different frequencies after one another - the first will Vblank at the frequency of your monitor output, while the second will Vblank at the fixed 59.94Hz frequency.

    The SDK document says the following about this:


    [Register or Login to view code]

    That would do two Vblanks at the refresh rate your monitor supports - not sure which is better - haven't yet tried it.

    Anyway, it sure seems a lot smoother. I might release a new version with this tweak in it and let people decide if it's better. In case you're going to test it with PAL games and complain that it's screwed up - well, don't - since PAL ROMs have been borked ever since I applied those APU patches from the post-SNES9x 1.52 patches. I think it has something to do with the way the screen is rendered using libgcm inside the Snes9x display callbacks.

    I think for PAL games, there would have to be a way of setting both Vblanks forcibly at 50Hz or something.

  9. #189
    Join Date
    Sep 2010
    Posts
    6
    I've posted a completed bsnes v069, and Ver Greeneyes has volunteered to try and port it to C++98. That's in-progress as we speak, though help would be appreciated. Very hopeful to see bsnes on the PS3.

    > So it has a definite use, but I'm not sure whether I'm using it here in the manner I'm supposed to use it - all I know is that the SNES according to byuu renders at 60.09hz, while the PS3 seems to run at whatever the monitor/TV you've hooked it up to can natively support at that resolution.

    SNES video is tricky. In progressive (99% of games), it's 60.09hz, in interlace it's 59.97hz. PAL has different timings as well for both modes.

    I would recommend you use the PS3 59.94hz mode for having more consistency, but don't forget that nothing's perfect. Even though it says 59.94hz, some will be closer to 59.93, some to 59.95, etc. Who knows how much variance there is. There will never be a perfect InputFrequency, so let users adjust it

  10. #190
    Join Date
    Sep 2010
    Posts
    157

    [Register or Login to view code]

    OK, now onto what I changed and what I have explored with some success:

    Credit should go to byuu for pointing me in the right direction here:

    [Register or Login to view code]

    Then add to the following (new line is in bold):


    [Register or Login to view code]

    Here's the thing - the reason (according to my assumption) that PAL games currently have such bad video and audio timing is because we need to set the PS3 videomode accordingly - namely, at a PAL resolution @ 50Hz or some other opportune refresh rate.

    Therefore, we need a way (before we launch the SNES9x emulator) to determine whether the ROM we have just loaded is a PAL or an NTSC ROM. Based on that, init_display() will then be called, except the video_state will be configured differently depending on whether a PAL ROM is about to be loaded or an NTSC ROM.

    I might have to search in the Snes9x documentation for a way to get at the region/videomode of a ROM before actually starting Snes9x.

    Also, the init_display function will probably have to be modified.

    Now, if we wanted to be pedantic - you'll notice that it's possible to even set the scan mode:


    [Register or Login to view code]

    The other value you can use is CELL_VIDEO_OUT_SCAN_MODE_INTERLACE; certain games (such as Seiken Densetsu 2/Secret of Mana and Seiken Densetsu 3) use high-res, 512x448 / 512x478 interlaced modes for some of the menu and text screens. If we wanted to, we could trigger a call to init_display() (once it has been modified to allow us to easily switch resolutions on the fly) inside:

    S9xDeinitUpdate (SNES9x callback)

    S9xDeinitUpdate is called once a complete SNES screen has been rendered into the GFX.Screen memory buffer, as per the 'porting.html' document.

    This is for resolutions: 256 x 224 (PAL), 256 x 239 (PAL) , 512 x 224 (NTSC), 512 x 239 (PAL)

    S9xContinueUpdate (SNES9x callback)

    This is the equivalent of S9xDeinitUpdate, except it's only meant for interlaced high-res resolutions (such as 512 x 448 (NTSC) and 512 x 478 (PAL).

    Basically, this callback is triggered once a screen at one of those two resolutions has been rendered into the GFX.Screen memory buffer.

    We could use this callback to call init_graphics and trigger a videomode with scanmode CELL_VIDEO_OUT_SCAN_MODE_INTERLACE - but I dunno, perhaps it's not worth the hassle.

    Colors

    BTW, another thing I changed that eisz might not be aware of - in his code, he did the following:


    [Register or Login to view code]

    This tells SNES9x to use the pixel format RGB565. So far, so good. But then when it comes time to set up the PS3 display, he chooses the following pixel format:

    setRenderTarget


    [Register or Login to view code]

    This did not make sense to me. So, instead, I chose the same color format as the one he selected for SNES9x:


    [Register or Login to view code]

    This made the colors look a lot better. Might even have had other beneficial effects, I dunno.

    Anyway, I think this is the key to getting the display just right - we need to do the same explicit resolution initialization for PAL games, but we also have to keep in mind that if someone with an old NTSC television set (that does not support 50Hz PAL) tries this, that it wouldn't do anything funny - I'm not even sure of what would happen. Perhaps still read which resolutions and refresh rates are permissible - there are function calls in the SDK for that.

Page 19 of 70 First ... 91819202969 ... Last

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in