Post subject: SNES9x1.52 Emulator Development
gocha
Any
Emulator Coder, Former player
Joined: 6/21/2006
Posts: 401
Location: Japan, Nagoya
Project page (Download available) http://code.google.com/p/snes9x-rr/ Snes9x-rr 1.52 branch https://snes9x-rr.googlecode.com/svn/branches/snes9x-152 Snes9x 1.52 official http://www.snes9x.com/phpbb2/viewtopic.php?t=4542 Snes9x official code repository (probably) https://github.com/snes9xgit/snes9x Other related topic(s): http://www.snes9x.com/phpBB2/viewtopic.php?t=4700
I am usually available on Discord server or Twitter.
Senior Moderator
Joined: 8/4/2005
Posts: 5777
Location: Away
Quoted the changelog because Snes9x forums are pissing me off.
Snes9x 1.52 
- IMPORTANT NOTICE: The structure of savestates (also known 
  as snapshots / freeze files) is incompatible with older 
  versions! Snes9x 1.52 cannot read the savestates created 
  by 1.51 or older.                                         (zones) 
- Highly acculate SPC700 and S-DSP emulation.               (Blargg) 
- Replaced APU emulation cores (SPC700 and S-DSP) with 
  ones provided by Blargg's SNES_SPC library. This renders 
  savestates incompatible with older versions.              (BearOso, zones) 
- SPC7110 emulation.                                        (byuu, neviksti) 
- Merged bsnes' SPC7110 emulation code. Note that the .rtc 
  file of Far East of Eden Zero is incompatible with older 
  versions.                                                 (zones) 
- Removed graphics pack support. It's no more necessary.    (zones) 
- Replaced S-RTC emulation code with bsnes' one to keep the 
  good compatibility of .rtc files between the two 
  emulators. As a result, Daikaijuu Monogatari 2 now 
  outputs the .rtc file, and its .srm file is incompatible 
  with older versions.                                      (zones) 
- Added savestate supports for DSP-2, DSP-4, ST-010 and 
  OBC1.                                                     (zones) 
- Added UPS support.                                        (byuu) 
- Fixed DSP-4 AI problem.                                   (Jonas Quinn) 
- Fixed invalid memory accesses in C4 and OBC1 codes.       (zones) 
- Fixed invalid memory accesses in BSX codes. My mistake.   (zones) 
- Fixed the read value of $213e, $4210 and $4211.           (zones) 
- Fixed the writing of word values at the memory boundary.  (zones) 
- Fixed the bug that the unnecessary SA-1 emulation 
  continues once any SA-1 games are launched.               (zones) 
- Removed old color blending codes.                         (zones) 
- Removed too-old Snes96 and ZSNES snapshot support.        (zones) 
- Updated command-line options.                             (zones) 
- Code cleaning.                                            (zones) 
- GTK+ : Added a port of Snes9x to the GTK+ toolkit.        (BearOso) 
- Unix : Reconstructed and simplified all the contents. 
  Some features have been removed to be simple, and many 
  options have changed. GTK+ port is recommended for most 
  of Linux users.                                           (zones) 
- Win32: Now uses snes9x.conf to prevent problems with 
  modified meaning of settings.                             (OV2) 
- Win32: Removed broken OpenGL mode.                        (OV2) 
- Win32: Removed support for 8bit output.                   (OV2) 
- Win32: Reworked settings dialogues to accomodate the 
  new APU core and display settings.                        (OV2) 
- Win32: Updated defaults to use D3D and XA2 (better 
  Vista and Win7 support).                                  (OV2) 
- Win32: Direct3D and XAudio2 support.                      (OV2) 
- Win32: Added Blargg's ntsc filter (three presets).        (OV2) 
- Mac  : Fixed corrupted screenshot on Intel Mac.           (zones) 
- Mac  : Fixed sudden abort in QuickTime movie export on 
  Intel Mac.                                                (zones) 
- Mac  : Changed sound settings for the new APU core.       (zones) 
- Mac  : Changed the default folder which Snes9x looks for 
  to 'Application Support' folder.                          (zones) 
- Mac  : Changed folder names: 'IPSs' -> 'Patches', 
  'BIOSs' -> 'BIOSes'.                                      (zones) 
- Mac  : Added Blargg's ntsc filter.                        (zones) 
- Mac  : Internal changes for Leopard and Snow Leopard.     (zones) 
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Tompa
Any
Editor, Expert player (2215)
Joined: 8/15/2005
Posts: 1941
Location: Mullsjö, Sweden
I gave Super Star Wars: Return of the Jedi an attempt using this version. For once the sound effects are at least working as they should be, that's awesome news! On the lower side, it is still not TAS-able. It's still back at the issue with the input I do while recording just happens on random when I replay the movie afterwards... What is it with this game that makes this to happen? There have been many desync issues with the other two Super Star Wars games, but I haven't tried them out as much. I'm tired of not being able to TAS this game :(.
gocha
Any
Emulator Coder, Former player
Joined: 6/21/2006
Posts: 401
Location: Japan, Nagoya
Experimental improved version of snes9x 1.52 (svn185) http://snes9x-rr.googlecode.com/files/snes9x-1.52-rr-r185.zip - Desync fixes - Add lag counter display - Add Gens style RAM Watch and RAM Search - Add Lua engine (pretty useless for now, the only available functions are: emu.message, input.get, memory read/write and hook functions) - Fix DEBUGGER build compilation errors - Fix d-pad autofire (in progress?) - Other minor modifications (drag and drop support, movie-free frame counter display, etc.) ---- Off Topic Fixed. Thanks a lot, the admin of the forum.
gocha wrote:
I cannot login to the official snes9x forum for now. When I changed my email address in Profile page, I encountered
Ran into problems sending Mail. Response: 451 Please try again later.

DEBUG MODE

Line : 153
File : smtp.php
and it made my account inactive :(
I am usually available on Discord server or Twitter.
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
Language: lua

local counter= 0 local function Fn() counter= counter+1 print(counter) end gui.register(Fn)
It... Works while paused! A thousand cheers for this progress! True, it runs slowly, and only when there's activity with either mouse or keyboard, but still, it runs while paused! This is a beautiful day!
Player (149)
Joined: 7/12/2006
Posts: 264
Location: Brazil
How can I use this version with Snes9x Memory Watcher Rev13? Thanks for the good work, Gocha!
gocha
Any
Emulator Coder, Former player
Joined: 6/21/2006
Posts: 401
Location: Japan, Nagoya
Dark Fulgore wrote:
How can I use this version with Snes9x Memory Watcher Rev13? Thanks for the good work, Gocha!
If you put right addresses to the config file, it works right :p Use built-in watch instead. I no longer support that old watch tool.
I am usually available on Discord server or Twitter.
Player (71)
Joined: 8/24/2004
Posts: 2562
Location: Sweden
Would be nice to be able to set for how many frames it will dump the AVI when outputting a movie for example. I hate to sit around to stop it manually, especially if it's a long run.
P.JBoy
Any
Editor
Joined: 3/25/2006
Posts: 850
Location: stuck in Pandora's box HELLPP!!!
You can simply use the "Pause at frame:" option in the movie play dialog; then you can either end the AVI recording yourself, or you can then decide exactly where to stop the recording afterwards so you don't need to find the exact frame beforehand. EDIT: Oh whoops, I mixed this up with VBA's option to do that. Though that would be an alternative thing to implement into snes9x
Player (137)
Joined: 9/18/2007
Posts: 389
One of the strange things I found in Snes9x 1.43 and 1.51 is that it produces different images for screenshots and AVI files. It might have something to do with the 2^16 colors limitation of the SNES. 1.52 will do the same at the moment. The following Lua script (which works for 1.43 and 1.51, but not for 1.52, there it says "gdscreenshot" is nil) demonstrates the problem.
require "gd"

--produces the same as using the "save screenshot" function
normalScreenshot = gd.createFromGdStr(gui.gdscreenshot())
normalScreenshot:png("normalScreenshot.png")

--produces the same as extracting an image from lossless RGB(!!) encoded AVI
snesXsize, snesYsize = 256, 224
videoScreenshot = gd.createTrueColor(snesXsize, snesYsize)
for j=0,snesXsize-1 do
	for k=0,snesYsize-1 do
		videoScreenshot:setPixel(j, k, videoScreenshot:colorAllocate(gui.getpixel(j,k)))
	end
end
videoScreenshot:png("videoScreenshot.png")
Joined: 4/2/2008
Posts: 103
Location: The Netherlands
partyboy1a wrote:
It might have something to do with the 2^16 colors limitation of the SNES.
Should be 2^15 - if I'm not mistaken, the SNES uses BGR555 internally. There are several ways to convert that to RGB888, the most mathematically correct is probably
uint15_t input;  // BGR555
uint24_t output; // RGB888
output = ((255 * ((input >>  0) & 5) + 15) / 31) << 16 |
         ((255 * ((input >>  5) & 5) + 15) / 31) <<  8 |
         ((255 * ((input >> 10) & 5) + 15) / 31) <<  0;
... where the + 15 is the integer version of rounding (that is, (int)(31/2)).
Post subject: Snes9x 1.52 vs. bsnes?
gocha
Any
Emulator Coder, Former player
Joined: 6/21/2006
Posts: 401
Location: Japan, Nagoya
Today, I tried to see if snes9x 1.52 runs slower (has more lag frames) than bsnes. Method 1: Set bsnes to accept background input, run both bsnes and snes9x then run the same demo. (requires enough fast machine) Method 2: Capture bsnes' emulation by kkapture, then compare it to snes9x avi output. Both methods are not absolutely reliable, still they were interesting. Games with no extra chips Method 1: I tried several games but both looked mostly identical. Method 2: http://youtu.be/sKVQ9P0SPjI (don't mind about audio desync/quality) Games with SuperFX (Star Fox) Method 1: Snes9x ran a bit slower. Method 2: http://youtu.be/HRUeDCmo-R4 (don't mind about audio quality) Note: According to several people in Japanese SMW ROM-hacking community, Snes9x's SuperFX emulation is not so accurate (not cycle-based, laggier, etc.) Games with SA1 (Kirby Super Star) I don't know if it's because of SA1, but anyway... Method 1: Method 2: Snes9x is laggier. It's noticable. http://youtu.be/dOxns6OjAcs (don't mind about audio quality) .kkapture / bsnes Settings 60fps, version 1.01 default Target process: bsnes-accurate.dll Smooth Video Output = off Sync Video = on Sync Audio = off D3D/DSound I don't know if it's appropriate.
I am usually available on Discord server or Twitter.
Post subject: Blend Hi-Res effect with AviSynth
gocha
Any
Emulator Coder, Former player
Joined: 6/21/2006
Posts: 401
Location: Japan, Nagoya
# Blend pixels horizontally for SNES Pseudo HiRes transparency
# Source image must not be downsized (i.e. width must be 512)
function SNESMergeHiRes(clip)
{
    Assert(clip.Width() == 512, "The video is not SNES Hi-Res image (width != 512)")
    shifted = clip.Crop(0, 0, -1, 0).AddBorders(1, 0, 0, 0).ResetMask
    return Layer(clip, shifted, level = 128)
}

v=AviSource("a.avi")
StackHorizontal(v.AddBorders(0,0,4,0), v.SNESMergeHiRes())
I am usually available on Discord server or Twitter.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Is there interest in using the bsnes core in SNES9x? Themaister has a project going on here: http://board.byuu.org/viewtopic.php?f=3&t=670&p=26910#p26910 (and following posts) https://github.com/Themaister/snes9x-libsnes
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Ver Greeneyes wrote:
Should be 2^15 - if I'm not mistaken, the SNES uses BGR555 internally. There are several ways to convert that to RGB888, the most mathematically correct is probably
uint15_t input;  // BGR555
uint24_t output; // RGB888
output = ((255 * ((input >>  0) & 5) + 15) / 31) << 16 |
         ((255 * ((input >>  5) & 5) + 15) / 31) <<  8 |
         ((255 * ((input >> 10) & 5) + 15) / 31) <<  0;
... where the + 15 is the integer version of rounding (that is, (int)(31/2)).
Yes, you're mistaken. & 5 is quite wrong. That is probably just a thinking error though. You want a & 31. Or, & ((1 << 5)-1). Converting a 0..31 value into 0..255 range: n*8 + n/4. (Rationale: 256/32 = 8 (the multiply value); 255 - 8*31 = 7 (missing value); 32/X = 7+1, solve X gets 4 (the divider).) I.e.
unsigned r = (input >> 10) & 31; r = r*8 + r/4;
unsigned g = (input >> 5) & 31; g = g*8 + g/4;
unsigned b = (input >> 0) & 31; b = b*8 + b/4;
// Note: almost all compilers produce shifts here. If that is not the case, write (r << 3) + (r >> 2) instead.
output = (r << 16) + (g << 8) + b;
Observing this code shows that the bits of the original value will end up as follows:
ONMLKjihgfEDCBA
->
ONMLKONMjihgfjihEDCBAEDC
Which means that the code can be translated to this:
output =
  ((input << 3) & (31 << 3))
| ((input << 6) & (31 << 11))
| ((input << 9) & (31 << 19))
| ((input >> 2) & (7 << 0))
| ((input << 1) & (7 << 8))
| ((input << 4) & (7 << 16));
Which is fewer shifts and ands overall total (6+6) than the previous one (11 + 3).