bsnes-libretro/nall
Tim Allen ca277cd5e8 Update to v100r14 release.
byuu says:

(Windows: compile with -fpermissive to silence an annoying error. I'll
fix it in the next WIP.)

I completely replaced the time management system in higan and overhauled
the scheduler.

Before, processor threads would have "int64 clock"; and there would
be a 1:1 relationship between two threads. When thread A ran for X
cycles, it'd subtract X * B.Frequency from clock; and when thread B ran
for Y cycles, it'd add Y * A.Frequency from clock. This worked well
and allowed perfect precision; but it doesn't work when you have more
complicated relationships: eg the 68K can sync to the Z80 and PSG; the
Z80 to the 68K and PSG; so the PSG needs two counters.

The new system instead uses a "uint64 clock" variable that represents
time in attoseconds. Every time the scheduler exits, it subtracts
the smallest clock count from all threads, to prevent an overflow
scenario. The only real downside is that rounding errors mean that
roughly every 20 minutes, we have a rounding error of one clock cycle
(one 20,000,000th of a second.) However, this only applies to systems
with multiple oscillators, like the SNES. And when you're in that
situation ... there's no such thing as a perfect oscillator anyway. A
real SNES will be thousands of times less out of spec than 1hz per 20
minutes.

The advantages are pretty immense. First, we obviously can now support
more complex relationships between threads. Second, we can build a
much more abstracted scheduler. All of libco is now abstracted away
completely, which may permit a state-machine / coroutine version of
Thread in the future. We've basically gone from this:

    auto SMP::step(uint clocks) -> void {
      clock += clocks * (uint64)cpu.frequency;
      dsp.clock -= clocks;
      if(dsp.clock < 0 && !scheduler.synchronizing()) co_switch(dsp.thread);
      if(clock >= 0 && !scheduler.synchronizing()) co_switch(cpu.thread);
    }

To this:

    auto SMP::step(uint clocks) -> void {
      Thread::step(clocks);
      synchronize(dsp);
      synchronize(cpu);
    }

As you can see, we don't have to do multiple clock adjustments anymore.
This is a huge win for the SNES CPU that had to update the SMP, DSP, all
peripherals and all coprocessors. Likewise, we don't have to synchronize
all coprocessors when one runs, now we can just synchronize the active
one to the CPU.

Third, when changing the frequencies of threads (think SGB speed setting
modes, GBC double-speed mode, etc), it no longer causes the "int64
clock" value to be erroneous.

Fourth, this results in a fairly decent speedup, mostly across the
board. Aside from the GBA being mostly a wash (for unknown reasons),
it's about an 8% - 12% speedup in every other emulation core.

Now, all of this said ... this was an unbelievably massive change, so
... you know what that means >_> If anyone can help test all types of
SNES coprocessors, and some other system games, it'd be appreciated.

----

Lastly, we have a bitchin' new about screen. It unfortunately adds
~200KiB onto the binary size, because the PNG->C++ header file
transformation doesn't compress very well, and I want to keep the
original resource files in with the higan archive. I might try some
things to work around this file size increase in the future, but for now
... yeah, slightly larger archive sizes, sorry.

The logo's a bit busted on Windows (the Label control's background
transparency and alignment settings aren't working), but works well on
GTK. I'll have to fix Windows before the next official release. For now,
look on my Twitter feed if you want to see what it's supposed to look
like.

----

EDIT: forgot about ICD2::Enter. It's doing some weird inverse
run-to-save thing that I need to implement support for somehow. So, save
states on the SGB core probably won't work with this WIP.
2016-07-30 13:56:12 +10:00
..
beat Update to v099r15 release. 2016-07-04 21:48:17 +10:00
database Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
decode Update to v097r14 release. 2016-02-16 20:11:58 +11:00
dsp Update to v098r15 release. 2016-06-05 14:52:43 +10:00
emulation Update to v099r15 release. 2016-07-04 21:48:17 +10:00
encode Update to v098r10 release. 2016-05-16 19:51:12 +10:00
hash Update to v098r10 release. 2016-05-16 19:51:12 +10:00
http Update to v099r16 release (public beta). 2016-07-04 21:53:24 +10:00
image Update to v098r10 release. 2016-05-16 19:51:12 +10:00
mosaic Update to v099r15 release. 2016-07-04 21:48:17 +10:00
posix Update to v099r14 release. 2016-07-01 21:50:32 +10:00
string Update to v100r14 release. 2016-07-30 13:56:12 +10:00
vector Update to v098r10 release. 2016-05-16 19:51:12 +10:00
vfs Update to v099r14 release. 2016-07-01 21:50:32 +10:00
windows Update to v099r16 release (public beta). 2016-07-04 21:53:24 +10:00
xorg Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
algorithm.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
any.hpp Update to v098r10 release. 2016-05-16 19:51:12 +10:00
atoi.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
bit-field.hpp Update to v099r15 release. 2016-07-04 21:48:17 +10:00
bit-vector.hpp Update to v098r19 release. 2016-06-09 08:26:35 +10:00
bit.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
config.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
directory.hpp Update to v099r16 release (public beta). 2016-07-04 21:53:24 +10:00
dl.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
endian.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
file.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
filemap.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
function.hpp Update to v100r08 release. 2016-07-18 08:11:29 +10:00
GNUmakefile Update to v097r02 release. 2016-01-25 22:27:18 +11:00
hashset.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
hid.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
image.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
inode.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
interpolation.hpp Update to v098r14 release. 2016-06-01 21:23:22 +10:00
intrinsics.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
location.hpp Update to v099r16 release (public beta). 2016-07-04 21:53:24 +10:00
main.hpp Update to v099r15 release. 2016-07-04 21:48:17 +10:00
map.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
matrix.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
maybe.hpp Update to v099r11 release. 2016-06-27 23:07:57 +10:00
memory.hpp Update to v099r01 release. 2016-06-14 20:51:54 +10:00
mosaic.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
nall.hpp Update to v099r16 release (public beta). 2016-07-04 21:53:24 +10:00
path.hpp Update to v099r16 release (public beta). 2016-07-04 21:53:24 +10:00
platform.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
primitives.hpp Update to v100r14 release. 2016-07-30 13:56:12 +10:00
property.hpp Update to v099r09 release. 2016-06-25 18:53:11 +10:00
queue.hpp Update to v098r13 release. 2016-06-01 08:29:36 +10:00
random.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
range.hpp Update to v098r08 release. 2016-05-02 19:57:04 +10:00
run.hpp Update to v099r15 release. 2016-07-04 21:48:17 +10:00
serial.hpp Update to v098r08 release. 2016-05-02 19:57:04 +10:00
serializer.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
service.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
set.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
shared-memory.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
shared-pointer.hpp Update to v098r10 release. 2016-05-16 19:51:12 +10:00
smtp.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
sort.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
stdint.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
string.hpp Update to v100r14 release. 2016-07-30 13:56:12 +10:00
thread.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
traits.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
unique-pointer.hpp Update to v097r02 release. 2016-01-25 22:27:18 +11:00
utility.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
varint.hpp Update to v099r14 release. 2016-07-01 21:50:32 +10:00
vector.hpp Update to v098r10 release. 2016-05-16 19:51:12 +10:00
vfs.hpp Update to v099r05 release. 2016-06-20 21:00:32 +10:00