Post v1.42 ZSNES WIPs

General area for talk about ZSNES. The best place to ask for related questions as well as troubleshooting.

Moderator: ZSNES Mods

Locked
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

byuu wrote:

Code: Select all

int32 color = int32(pow(double(color) / 256.0, gamma) * 256.0);
color = (color > 255) ? 255 : ((color < 0) ? 0 : color);
//color >>= 3; for 15-bit
That has got to be slooooooooooow.
Are you realy using the floating point or negatives at all?

Try this:

Code: Select all

unsigned int npow(register unsigned int base, register unsigned int exponent)
{
  register unsigned int total = 1;
  if (exponent)
  {
    register unsigned int i;
    for (i = 2, total = base; i < exponent; i += i)
    {
      total *= total;
    }
    for (i >>= 1; i < exponent; i++)
    {
      total *= base;
    }
  }
  return(total);
}

color = npow(color, gamma) / 256;
I'm not sure if the math for the gamma normalize, is correct. I'll look at it more later when I'm awake, but stay away from floating point if you can.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

The code is used for color table generation, so it's executed once for each time you start the emulator. I don't really consider it an important area of optimization.

Negatives, no. Those aren't really needed. I just always min+max my color integers, no reason really.

Floating point is a necessity. I'll admit having no mathematical education above Algebra II (part of the reason I won't touch DSP-1), but I'd be thoroughly impressed if you could convert that function to fixed-point math. Much less so if you used floating point to calculate some sort of integer-based "step" value first.

Basically, gamma is 1.0 by default. Since color is raised to the power of gamma, color has to be between 0 and 1. This allows 0^g=0, and also 1^g=1. Thusly, the darkest color is the darkest possible, and the brightest color is the brightest possible. All values inbetween form a bent curve connecting the two points, with 1.0 representing a straight line, >1 representing a lower bent line, and <1 representing a higher bent line (the bend direction is "backwards" because power of is always applied to a fractional number).

In order to not require floating point, gamma would have to be a whole integer. And when you start raising the power-of variable gamma by whole numbers, the result grows exponentially fast and offers very little control over the result. e.g. for each g in c^g, you need an additional 8 bits of precision. c^4 is the highest safe number you can use with a 32-bit integer. Not very flexible.
Hyos
Regular
Posts: 207
Joined: Mon Aug 15, 2005 2:15 pm

Post by Hyos »

Ipher has a February 17 WIP up.
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

yup, boards were down when i released it

2/17/06
ALL: Fixed crash after enabling Sound Interpolation mid game. [Jonas Quinn]
ALL: Removed off by 1 line fix. [Jonas Quinn]
ALL: Fixed burning effect in executables compiled with GCC. [Jonas Quinn]
ALL: Partial RTO support, FF3 cursor now fixed. [pagefault]
W_S: Some speedup for non DOS ports. [Jonas Quinn]
W_S: Overhauled WIP Message. [Nach]
WIN: Fixed black screen after the computer was locked. [Jonas Quinn]
DSP4: Fixed turn offs. [Nach]
GUI: Implemented delay function for windows, fixes some annoyances in the GUI [pagefault]
GUI: Fixed Gaussian always selected bug when MMX Support is disabled. [Jonas Quinn]
GUI: Some options that are only available with MMX enabled are now hidden if MMX is disabled. [Jonas Quinn]
GUI: Fixed garbled screen after VSync or Trible Buffering is enabled. [Jonas Quinn]
GUI: Optimized code a bit. [Jonas Quinn]
GUI: Fixed missing shadow in F1 Menu. [Jonas Quinn]
GUI: Fixed extra lines on top in F1 Menu and in screenshots. [Jonas Quinn]
GUI: Revamped the Movie window [ipher, Nach]
SRC: Removed some DOS only code from other ports. [Jonas Quinn]
SRC: Cleanup and removal of dead code. [Jonas Quinn]
SRC: Fixed a minor bug in objfix [Jonas Quinn]
SRC: Fixed warning in VS.NET 2005 [pagefault]
SRC: Fixed some GCC 4 warnings. [Jonas Quinn]
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Note to ipher: Wrong date on your site (the ZSNES WIP section) :P :wink:

I have a question though... if RTO is partially implemented.. what games other than FF3 are affected/not affected then? (I really don't know which games use RTO other than FF3)... and define how "partial" it is (I definately know it affects the FF3 menus in a battle, but is there more to that?)
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Jipcy
Veteran
Posts: 768
Joined: Thu Feb 03, 2005 8:18 pm
Contact:

Post by Jipcy »

ipher wrote:ALL: Removed off by 1 line fix. [Jonas Quinn]
Just out of curiosity, what was this fix for?
[url=http://zsnes-docs.sf.net]Official ZSNES Docs[/url] | [url=http://zsnes-docs.sf.net/nsrt]NSRT Guide[/url] | [url=http://endoftransmission.net/phpBB3/viewtopic.php?t=394]Using a Wiimote w/ emulators[/url]
Jonas Quinn
ZSNES Developer
ZSNES Developer
Posts: 115
Joined: Thu Jul 29, 2004 9:51 pm
Location: Germany

Post by Jonas Quinn »

Jipcy wrote:
ipher wrote:ALL: Removed off by 1 line fix. [Jonas Quinn]
Just out of curiosity, what was this fix for?
It never did anything. At least for all post 1.17 builds.
Starman Ghost
Trooper
Posts: 535
Joined: Wed Jul 28, 2004 3:26 am

Post by Starman Ghost »

Wow, wip looks awesome, Jonas seems to be doing quite a bit of work on zsnes I noticed.
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

another WIP, and pagefault does want bug reports for this one

2/18/06
Added gamma support to 16-bit new gfx engine [pagefault]
SA1 IRQ timing/counter overflow fix, this should fix SA1 games that were previously freezing [pagefault]
Timing fixes for games [pagefault]
Remove FF3 hack, FF3 works perfectly now! [pagefault]
FF3 cursor bug fixes, sprite rendering fixes to support RTO properly, FF3 mode 7 DMA timing fixings [pagefault]
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

Brilliant absoloutly brilliant... need i say more? :D :D
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
Stifu
Regular
Posts: 245
Joined: Fri Dec 10, 2004 10:02 pm

Post by Stifu »

Kick ass... 3 new releases in a row.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

thank you nach, pagefault, grinvader and others cant wait to use your avi library!

cant select "use primary buffer" for sound!
emulation freezes when entering name in mario rpg.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
Agozer
16-bit Corpse | Nyoron~
Posts: 3534
Joined: Sun Aug 01, 2004 7:14 pm
Location: Nokia Land

Post by Agozer »

Excellent work guys.
whicker: franpa is grammatically correct, and he still gets ripped on?
sweener2001: Grammatically correct this one time? sure. every other time? no. does that give him a right? not really.
Image
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Wow! :shock: :P

That's good news indeed.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Remove FF3 hack, FF3 works perfectly now! [pagefault]
FF3 cursor bug fixes, sprite rendering fixes to support RTO properly, FF3 mode 7 DMA timing fixings [pagefault]
I've yet to test the RTO fix (I'm still trying to remember what is needed to expose it).. however.. the FF3 overworld fix (which I presume is part of it) fails to work in every version of FF3 (version 1.0 and 1.1, including FF6j)

Edit: The RTO fix doesn't appear to work at all...

2nd Edit: I'm starting to think these fixes were incorporated further down the CVS tree (or whatever) and the code compiled here clearly doesn't include the FF3 fixes.
Last edited by Deathlike2 on Sun Feb 19, 2006 7:31 pm, edited 2 times in total.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
snkcube
Hero of Time
Posts: 2646
Joined: Fri Jul 30, 2004 2:49 am
Location: In front of the monitor
Contact:

Post by snkcube »

Great work devs. :)
Try out CCleaner and other free software at Piriform
Image
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

nice, need to get on these :x
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

franpa_9 wrote:cant select "use primary buffer" for sound!
emulation freezes when entering name in mario rpg.
I don't think the SA-1 fixes were actually incorporated with this build...

As for the Primary Buffer... the option definately cannot be selected.. but I don't think that will prevent sound from playing..

There is a move by pagefault to rewriting the sound output of ZSNES.. so I wouldn't be surprised if this was intentional at this point.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

son of a.... my batch file failed to update the CVS tree before compiling the WIN and DOS versions... im pulling the release now, and will make a new release later today (with even more fixes!)
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

ipher wrote:son of a.... my batch file failed to update the CVS tree before compiling the WIN and DOS versions... im pulling the release now, and will make a new release later today (with even more fixes!)
I knew something like this was happening.. mwahahaha..

All we need now is the fabled "SPC Rape fix" and then the world... mmm.. I'll be happier with more fixes :wink:
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Hyos
Regular
Posts: 207
Joined: Mon Aug 15, 2005 2:15 pm

Post by Hyos »

Isn't the Square sound rape working, just you have to set 32 kHz and Gaussian? I vaguely remember Nach or pagefault posting something like this.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

http://board.zsnes.com/phpBB2/viewtopic ... z+gaussian

pagefault said that certain cases prevented it from working though...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

new WIP, it should be the real deal this time :)

2/19/06
ALL: Added gamma support to 16-bit new gfx engine [pagefault]
ALL: SA1 IRQ timing/counter overflow fix, this should fix SA1 games that were previously freezing [pagefault]
ALL: Timing fixes for games [pagefault]
ALL: Remove FF3 hack, FF3 works perfectly now! [pagefault]
ALL: FF3 cursor bug fixes, sprite rendering fixes to support RTO properly, ALL: FF3 mode 7 DMA timing fixings [pagefault]
ALL: Fixed program counter in RET macro, Dirt Racer now plays with some blinking, making progress :) [pagefault]
ALL: Made STOP clear the IRQ flag when it's set, this fixes Star Fox 2 [pagefault]
WIN: Fixed disable Screensaver option. [Jonas Quinn]
GUI: Fixed Primary Buffer option. [Jonas Quinn]
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Is this WIP commentable on or not? I have a couple of questions on the RTO support...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
xamenus
Veteran
Posts: 907
Joined: Fri Jul 30, 2004 12:26 am

Post by xamenus »

Everything looks great, can't wait till everything's stable and finished. :)
Locked