1. 07 Oct, 2017 1 commit
    • Screwtape's avatar
      Update to v105 release. · f8e71b50
      Screwtape authored
      byuu says:
      This release provides several major improvements to Mega Drive emulation
      which enhances compatibility a good deal. It also includes important
      Super Famicom mosaic emulation improvements, plus a much-needed SuperFX
      save state issue fix.
      Changelog (since v104):
        - higan: many improvements to Emulator::Interface to support
        - higan: refreshed program icon
        - icarus: new program icon
        - Game Boy Advance: slight emulation speedup over v104
        - Game Boy Advance: synchronize APU FIFO updates better
        - Mega Drive: added automatic region detection [hex_usr]
        - Mega Drive: support 8-bit SRAM
        - Game Boy Advance: fixed bug when changing to THUMB mode via MSR
        - Master System: fix bug in backdrop color and background 0 priority
        - Mega Drive: backgrounds always update output priority bit [Cydrak]
        - Mega Drive: emulated interlaced video output
        - Mega Drive: emulated shadow/highlight mode [Cydrak]
        - Super Famicom: auto joypad polling clears the shift register when
        - Super Famicom: added new low-entropy RAM initialization mode to more
          closely match hardware
        - Game Boy Advance: rumble will now time out after being left on for
        - ruby: improved rumble support in udev input driver [ma_rysia]
        - M68K: `move.b (a7)[+/-]` adjust a7 by two
        - M68K: illegal/lineA/lineF opcodes do not modify the stack register
        - Mega Drive: emulate VIP status bit
        - uPD7725: improved emulation of OV1/S1 flags [byuu, AWJ, Lord
        - uPD7725: improved handling of DP, RP updates [Jonas Quinn]
        - Super Famicom: improved emulation of mosaic effects in hires,
          interlace, and offset-per-tile modes [byuu, Cydrak]
        - ruby: improved Direct3D exclusive mode monitor selection [Cydrak]
        - Super Famicom: fixed save state bug affecting SuperFX games
        - Mega Drive: added workaround for Clang compiler bug; allowing this
          core to work on macOS [Cydrak, Sintendo]
        - higan: hotkeys now also trigger when the main window lacks focus yet
          higan is set to allow input on focus loss
        - higan: fixed an edge case where `int16_t`  `double` audio
          conversion could possibly result in overflows
        - higan: fixed a crash on macOS when choosing quit from the
          application menu [ncbncb]
      Changelog (since the previous WIP):
        - higan: restored `make console=true`
        - tomoko: if you allow input when main window focus is lost, hotkeys
          can now be triggered without focus as well
        - hiro/cocoa: fix crash on exit from menu [ncbncb]
        - ruby: smarter `double` → `int16_t` conversion to prevent
  2. 05 Oct, 2017 1 commit
    • Screwtape's avatar
      Update to v104r17 release. · 9a13863a
      Screwtape authored
      byuu says:
        - processor/m68k: fix error in disassembler [Sintendo]
        - processor/m68k: work around Clang compiler bug [Cydrak, Sintendo]
      This is one of the shortest WIPs I've done, but I'm trying not to change
      anything before v105.
  3. 02 Oct, 2017 1 commit
    • Screwtape's avatar
      Update to v104r16 release. · 5dbaec85
      Screwtape authored
      byuu says:
        - processor/upd96050: always potentially update S1 on ALU ops, sans NOP
            - theory by Lord Nightmare. I'm impartial on this one, but may as
              well match his design
        - sfc: fixed save state hang [reported by FitzRoy; fixed by Cydrak]
        - icarus: do not save settings.bml file when in library mode
  4. 29 Sep, 2017 1 commit
    • Screwtape's avatar
      Update to v104r15 release. · 6524a718
      Screwtape authored
      byuu says:
        - processor/huc6280,mos6502,wdc65816: replaced abbreviated opcode
          names with descriptive names
        - nall: replaced `PLATFORM_MACOSX` define with `PLATFORM_MACOS`
        - icarus: added `Icarus::missing() -> string_vector` to list missing
          appended firmware files by name
        - ruby, hiro: fix macosx→macos references
      The processor instruction renaming was really about consistency with the
      other processor cores. I may still need to do this for one or two more
      The icarus change should allow a future release of the icarus
      application to import games with external SNES coprocessor firmware once
      again. It will also allow this to be possible when used in library mode.
  5. 24 Sep, 2017 1 commit
    • Screwtape's avatar
      Update to v104r14 release. · fbc58c70
      Screwtape authored
      byuu says:
        - Emulator::Interface::videoResolution() -\> VideoResolution renamed
          to videoInformation() -\> VideoInformation
        - added double VideoInformation::refreshRate
        - higan: added `binary := (application|library)` — set this to
          `library` to produce a dynamic link library
        - higan: removed `-march=native` for macOS application builds; and for
          all library builds
        - higan: removed `console` build flag; uncomment  `link += -mwindows`
        - nall/GNUmakefile: `macosx` platform renamed `macos`
            - still need to do this for nall/intrinsics.hpp
        - Game Gear: return region=NTSC as the only option, so that the system
          frequency is always set correctly
        - hiro/cocoa: fixed typo [Sintendo]
        - hiro/Windows: removed GetDpiForMonitor, as it's Windows 8+ only; DPI
          is no longer per-monitor aware
        - icarus: core Icarus class now has virtual functions for
          directory::create, <file::exists>, <file::copy>, <file::write>
        - icarus: Sufami Turbo can import save RAM files now
        - icarus: setting `ICARUS_LIBRARY` define will compile icarus without
          main(), GUI components
        - ruby/video/Direct3D: choose the current monitor instead of top-left
          monitor for fullscreen exclusive [Cydrak]
        - ruby/video/Direct3D: do not set `WS_EX_TOPMOST` on fullscreen
          exclusive window [Cydrak]
            - this isn't necessary for exclusive mode, and it just makes
              getting out of the application more difficult
  6. 08 Sep, 2017 1 commit
    • Screwtape's avatar
      Update to v104r13 release. · 1ff31583
      Screwtape authored
      byuu says:
        - nall/GNUmakefile: build=release changed to -O2, build=optimize is
          now -O3
        - hiro: added Monitor::dpi(uint index) → Position [returns logical
          DPI for x, y]
            - Position is a bad name, but dpi(monitor).(x,y)() make more sense
              than .(width,height)()
        - hiro: Position, Size, Geometry, Font changed from using signed int
          to float
        - hiro: Alignment changed from using double to float
        - hiro: added skeleton (unused) Application::scale(), setScale()
        - hiro/cocoa's Monitor::dpi() is untested. Probably will cause issues
          with macOS' automatic scaling.
        - hiro/gtk lacks a way to get both per-monitor and per-axis (x,y) DPI
        - hiro/qt lacks a way to get per-monitor DPI scaling (Qt 5.x has this,
          but I still use Qt 4.x)
            - and just to get global DPI, hiro/qt's DPI retrieval has to use
              undocumented functions ... fun
      The goal with this WIP was basically to prepare hiro for potential
      automatic scaling. It'll be extremely difficult, but I'm convinced that
      it must be possible if macOS can do it.
      By moving from signed integers to floats for coordinates, we can now
      scale and unscale without losing precision. That of course isn't the
      hard part, though. The hard part is where and how to do the scaling. In
      the ideal application, hiro/core and hiro/extension will handle 100% of
      this, and the per-platform hiro/(cocoa,gtk,qt,windows) will not be aware
      of what's going on, but ... to even make that possible, things will need
      to change in every per-platform core, eg the per-platform code will have
      to call a core function to change geometry, which will know about the
      scaling and unscale the values back down again.
      Gonna be a lot of work, but ... it's a start.
  7. 06 Sep, 2017 1 commit
    • Screwtape's avatar
      Update to v104r12 release. · 4fb8ce28
      Screwtape authored
      byuu says:
        - higan: URLs updated to HTTPS
        - sfc/ppu/background: use hires/interlace/mosaic-adjusted X/Y
          coordinates for offset-per-tile mode
        - sfc/ppu/background: hires mosaic seems to advance pixel counter on
          subscreen pixels
        - tomoko: added “Help→Credits” menu option (currently the page does
          not exist; should before v105)
        - tomoko: reduced volume slider from {0% - 500%} to {0% - 200%}.
          Distortion is too intense above 200%.
            - technically, I've encountered distortion at 200% as well in
              Prince of Persia for the SNES
        - nall/run/invoke: use program path for working directory
            - allows you to choose “Library→Import ROMs” from a different
              directory on the command-line
      I don't know how to assign credit for the mosaic stuff. It's been a
      work-in-progress with me, Cydrak, and hex_usr.
      The current design should be correct, but very unpleasant. The code
      desperately needs to be refactored, but my recent attempt at doing so
      ended in spectacular failure.
  8. 05 Sep, 2017 1 commit
    • Screwtape's avatar
      Update to v104r11 release. · 3dce3aa3
      Screwtape authored
      byuu says:
        - sfc/ppu/background: minor code cleanup and simplification
        - sfc/ppu/background: $2106 MOSAIC register was implemented
        - sfc/ppu/background: fixed mosaic effects in hires mode (temporary
        - sfc/ppu/background: fixed mosaic effects in interlace mode [Cydrak]
        - sfc/ppu/background/background.cpp:48: should be
          `if(!mosaic.enable) {`
      Turns out there is only one mosaic size, and the other four bits are
      per-BG mosaic enable. This matters a lot for hires/interlace, as
      mosaicSize=0 (2x2) is not the same thing as mosaicEnable=false (1x1).
      Although I've now implemented this, I really don't like how my mosaic
      implementation works right now. I tried to redesign the entire system,
      and completely failed. So I started over from v104r10 again and instead
      went with a more evolutionary improvement for now. I'll keep trying.
      Also, the combination of mosaic + offset-per-tile is still sketchy, as
      is mode 6 offset-per-tile. I'll get to those in the future as well.
  9. 01 Sep, 2017 1 commit
    • Screwtape's avatar
      Update to v104r10 release. · 28060d3a
      Screwtape authored
      byuu says:
        - processor/upd96050: per manual errata note, SGN always uses SA1;
          never SB1 [fixes v104r09 regression]
        - processor/upd96050: new OV1/S1 calculation that doesn't require OV0
          history buffer [AWJ]
        - processor/upd96050: do not update DP in OP if DST=4 [Jonas Quinn]
        - processor/upd96050: do not update RP in OP if DST=5 [Jonas Quinn]
        - resource: recreated higan+icarus icons, higan logo as 32-bit PNGs
      So higan v104r08 and earlier were 930KiB for the source tarball. After
      creating new higan and icarus icons, the size jumped to 1090KiB, which
      was insane for only adding one additional icon.
      After digging into why, I discovered that ImageMagick defaults to
      64-bit!! (16-bits per channel) PNG images when converting from SVG.
      You know, for all those 16-bit per channel monitors that don't exist.
      Sigh. Amazingly, nobody ever noticed this.
      The logo went from 78.8KiB to 24.5KiB, which in turn also means the
      generated resource.cpp shrank dramatically.
      The old higan icon was 32-bit PNG, because it was created before I
      installed FreeBSD and switched to ImageMagick. But the new higan icon,
      plus the new icarus icon, were both 64-bit as well. And they're now
      So the new tarball size, thanks to the logo optimization, dropped to
      Cydrak had some really interesting results in converting higan's
      resources to 8-bit palletized PNGs with the tRNS extension for alpha
      transparency. It reduces the file sizes even more without much visual
      fidelity loss. Eg the higan logo uses 778 colors currently, and 256
      represents nearly all of it very well to the human eye. It's based off
      of only two colors, the rest are all anti-aliasing. Unfortunately,
      nall/image doesn't support this yet, and I didn't want to flatten the
      higan logo to not have transparency, in case I ever want to change the
      about screen background color.
  10. 31 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v104r09 release. · 5352c5ab
      Screwtape authored
      byuu says:
        - processor/upd96050: SGN should select between (A,B).S1 flag using
          ASL opcode bit
        - processor/upd96050: use a temporary to cache new S1, then compute
          OV1 using old S1, then assign new S1
        - processor/upd96050: add SR.(siack,soack) and connect to relevant
          jump instructions (serial not implemented)
        - processor/upd96050: initialize SR properly in power() [r08
        - icarus: improve Makefile rules [Screwtape]
        - higan: new program icon
        - icarus: new program icon
  11. 30 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v104r08 release. · 25bda4f1
      Screwtape authored
      byuu says:
        - processor/upd96050: code cleanups
        - processor/upd96050: improved emulation of S1/OV1 flags [thanks to
          Cydrak, Lord Nightmare]
        - tomoko/settings/audio: reduced the size of the frequency/latency
          combo boxes to show longer device driver names
      Errata: I need to clear regs.sr in uPD96050::power()
      Note: the S1/OV1 emulation is likely not 100% correct yet, but it's a
      step in the right direction. No SNES games actually use S1/OV1, so this
      shouldn't result in any issues, I'd just like to have this part of the
      chip emulated correctly.
  12. 28 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v104r07 release. · 9c25f128
      Screwtape authored
      byuu says:
        - md/vdp: added VIP bit to status register; fixes Cliffhanger
        - processor/m68k/disassembler: added modes 7 and 8 to LEA address
        - processor/m68k/disassembler: enhanced ILLEGAL to display LINEA/LINEF
          $xxx variants
        - processor/m68k: ILLEGAL/LINEA/LINEF do not modify the stack
          register; fixes Caeser no Yabou II
        - icarus/sfc: request sgb1.boot.rom and sgb2.boot.rom separately; as
          they are different
        - icarus/sfc: removed support for external firmware when loading ROM
      The hack to run Mega Drive Ballz 3D isn't in place, as I don't know if
      it's correct, and the graphics were corrupted anyway.
      The SGB boot ROM change is going to require updating the icarus database
      as well. I will add that in when I start dumping more cartridges here
      Finally ... I explained this already, but I'll do so here as well: I
      removed icarus' support for loading SNES coprocessor firmware games with
      external firmware files (eg dsp1.program.rom + dsp1.data.rom in the same
      path as supermariokart.sfc, for example.)
      I realize most are going to see this as an antagonizing/stubborn move
      given the recent No-Intro discussion, and I won't deny that said thread
      is why this came to the forefront of my mind. But on my word, I honestly
      believe this was an ineffective solution for many reasons not related to
      our disagreements:
       1. No-Intro distributes SNES coprocessor firmware as a merged file, eg
          "DSP1 (World).zip/DSP1 (World).bin" -- icarus can't possibly know
          about every ROM distribution set's naming conventions for firmware.
          (Right now, it appears GoodSNES and NSRT are mostly dead; but there
          may be more DATs in the future -- including my own.)
       2. Even if the user obtains the firmware and tries to rename it, it
          won't work: icarus parses manifests generated by the heuristics
          module and sees two ROM files: dsp1.program.rom and dsp1.data.rom.
          icarus cannot identify a file named dsp1.rom as containing both
          of these sub-files. Users are going to have to know how to split
          files, which there is no way to do on stock Windows. Merging files,
          however, can be done via `copy /b supermariokart.sfc+dsp1.rom
          supermariokartdsp.sfc`; - and dsp1.rom can be named whatever now.
          I am not saying this will be easy for the average user, but it's
          easier than splitting files.
       3. Separate firmware breaks icarus' database lookup. If you have
          pilotwings.sfc but without firmware, icarus will not find a match
          for it in the database lookup phase. It will then fall back on
          heuristics. The heuristics will pick DSP1B for compatibility with
          Ballz 3D which requires it. And so it will try to pull in the
          wrong firmware, and the game's intro will not work correctly.
          Furthermore, the database information will be unavailable, resulting
          in inaccurate mirroring.
      So for these reasons, I have removed said support. You must now load
      SNES coprocessor games into higan in one of two ways: 1) game paks with
      split files; or 2) SFC images with merged firmware.
      If and when No-Intro deploys a method I can actually use, I give you all
      my word I will give it a fair shot and if it's reasonable, I'll support
      it in icarus.
  13. 26 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v104r06 release. · afa8ea61
      Screwtape authored
      byuu says:
        - gba,ws: removed Thread::step() override¹
        - processor/m68k: move.b (a7)+ and move.b (a7)- adjust a7 by two, not
          by one²
        - tomoko: created new initialize(Video,Audio,Input)Driver() functions³
        - ruby/audio: split Audio::information into
        - ws: added Model::(WonderSwan,WonderSwanColor,SwanCrystal)()
          functions for consistency with other cores
      ¹: this should hopefully fix GBA Pokemon Pinball. Thanks to
      SuperMikeMan for pointing out the underlying cause.
      ²: this fixes A Ressaha de Ikou, Mega Bomberman, and probably more
      ³: this is the big change: so there was a problem with WASAPI where
      you might change your device under the audio settings panel. And your
      new device may not support the frequency that your old device used. This
      would end up not updating the frequency, and the pitch would be
      The old Audio::information() couldn't tell you what frequencies,
      latencies, or channels were available for all devices simultaneously, so
      I had to split them up. The new initializeAudioDriver() function
      validates you have a correct driver, or it defaults to none. Then it
      validates a correct device name, or it defaults to the first entry in
      the list. Then it validates a correct frequency, or defaults to the
      first in the list. Then finally it validates a correct latency, or
      defaults to the first in the list.
      In this way ... we have a clear path now with no API changes required to
      select default devices, frequencies, latencies, channel counts: they
      need to be the first items in their respective lists.
      So, what we need to do now is go through and for every audio driver that
      enumerates devices, we need to make sure the default device gets added
      to the top of the list. I'm ... not really sure how to do this with most
      drivers, so this is definitely going to take some time.
      Also, when you change a device, initializeAudioDriver() is called again,
      so if it's a bad device, it will disable the audio driver instead of
      continuing to send samples at it and hoping that the driver blocked
      those API calls when it failed to initialize properly.
      Now then ... since it was a decently-sized API change, it's possible
      I've broken compilation of the Linux drivers, so please report any
      compilation errors so that I can fix them.
  14. 24 Aug, 2017 2 commits
    • Screwtape's avatar
      Update to v104r05 release. · b38a6571
      Screwtape authored
      byuu says:
        - emulator/random: new array function with more realistic RAM
        - emulator/random: both low and high entropy register initializations
          now use PCG
        - gba/player: rumble will time out and disable after being left on for
          500ms; fixes Pokemon Pinball issue
        - ruby/input/udev: fixed rumble effects [ma\_rysia]
        - sfc/system: default to low-entropy randomization of memory
      The low-entropy memory randomization is modeled after one of my SHVC
      2/1/3 systems. It generates striped patterns in memory, using random
      inputs (biased to 0x00/0xff), and has a random chance of corrupting 1-2
      bits of random values in the pool of memory (to prevent easy emulator
      detection and to match observed results on hardware.)
      The reasoning for using PCG on register initializations, is that I don't
      believe they're going to have repeating patterns like RAM does anyway.
      And register initializations are way more vital.
      I want to have the new low-entropy RAM mode tested, so at least for the
      next few WIPs, I've set the SNES randomization over to low-entropy.
      We'll have to have a long discussion and decide whether we want official
      releases to use high-entropy or low-entropy.
      Also, I figured out the cause of the Prince of Persia distortion ... I
      had the volume under the audio settings tab set to 200%. I didn't
      realize there were SNES games that clipped so easily, given how
      incredibly weak SNES audio is compared to every other sound source on my
      PC. So with no entropy or low-entropy, indeed the game now sounds just
      I can't actually test the udev fixes, so I guess we'll see how that goes
      for Screwtape and ma\_rysia.
    • Screwtape's avatar
      Update to v104r04 release. · d621136d
      Screwtape authored
      byuu says:
        - higan/emulator: added new Random class with three entropy settings:
          none, low, and high
        - md/vdp: corrected Vcounter readout in interlace mode [MoD]
        - sfc: updated core to use the new Random class; defaults to high
      No entropy essentially returns 0, unless the random.bias(n) function is
      called, in which case, it returns n. In this case, n is meant to be the
      "logical/ideal" default value that maximizes compatibility with games.
      Low entropy is a very simple entropy modeled after RAM initialization
      striping patterns (eg 32 0x00s, followed by 32 0xFFs, repeating
      throughout.) It doesn't "glitch" like real hardware does on rare
      occasions (parts of the pattern being broken from time to time.) It also
      only really returns 0 or ~0. So the entropy is indeed extremely low, and
      not very useful at all for detecting bugs. Over time, we can try to
      improve this, of course.
      High entropy is PCG. This replaces the older, lower-entropy and more
      predictable, LFSR. PCG should be more than enough for emulator
      randomness, while still being quite fast.
      Unfortunately, the bad news ... both no entropy and low entropy fix the
      Konami logo popping sound in Prince of Persia, but all three entropy
      settings still cause the distortion in-game, especially evident at the
      title screen. So ... this may be a more serious bug than first
  15. 22 Aug, 2017 2 commits
    • Screwtape's avatar
      Update to v104r03 release. · d13f1dd9
      Screwtape authored
      byuu says:
        - md/vdp: added full interlace emulation [byuu, Sik, Eke, Mask of
        - md/vdp: fix an issue with overscan/highlight when setting was
          disabled [hex\_usr]
        - md/vdp: serialize field, and all oam/objects state
        - icarus/md: do not enable RAM unless header 0x1b0-1b1 == "RA"
      I really can't believe how difficult the interlace support was to add. I
      must have tried a hundred combinations of adjusting Y, Vscroll, tile
      addressing, heights, etc. Many of the changes were a wash that improved
      some things, regressed others.
      In the end I ended up needing input from three different people to
      implement what should have been trivial. I don't know if the Mega Drive
      is just that weird, if I've declined that much in skill since the days
      when I implemented SNES interlace, or if I've just never been that good.
      But either way, I'm disappointed in myself for not being able to figure
      either this or shadow/highlight out on my own. Yet I'm extremely
      grateful to my friends for helping carry me when I get stuck.
      Since it wasn't ever documented before, I'm going to try and document
      the changes necessary to implement interlace mode for any future
    • Screwtape's avatar
      Update to v104r02 release. · 11357169
      Screwtape authored
      byuu says:
        - md/vdp: backgrounds always update priority bit output [Cydrak]
        - md/vdp: vcounter.d0 becomes vcounter.d8 in interlace mode 3
        - md/vdp: return field number in interlace modes from status register
        - md/vdp: rework scanline/frame counting in main loop so first frame
          won't clock to field 1 instead of field 0
        - md/vdp: add support for shadow/highlight mode; optimize to minimal
          code [Cydrak]
        - md/vdp: update outputPixel() to support interlace modes
        - sfc/cpu: auto joypad polling start should clear the shift registers;
          fixes Nuke (PD)
            - thanks to BMF54123 for this bug report
        - tomoko: if an invalid video/audio/input driver is found in the
          configuration file, it's reset to "None"
            - prevents showing the wrong driver under advanced settings; no
              longer requires possibly two reboots to fix
      Note: the Mega Drive interlace mode 1 should be working fully, but I
      don't know any games that use it. Interlace mode 3 (Sonic 2's two-player
      mode) does not work at all yet, but this is a good start.
  16. 18 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v104r01 release. · 366e9ceb
      Screwtape authored
      byuu says:
        - gba/cpu: synchronize to the PPU, not oneself, when the CPU is
            - this bug was patched in the official v104 release; but not in
              the .tar.xz archive
        - ms/vdp: backdrop color is on the second 16-entry palette, not the
          first [hex\_usr]
        - ms/vdp: fix background color 0 priority; fixes Alex Kidd in High
          Tech World text boxes [hex\_usr]
        - tomoko: choose first option when loading files via the command-line
        - icarus: lo/hi RAM addressing was backwards; M68K is big endian;
          fixes save files in Sonic 3
      Many thanks to hex\_usr for the Master System / Game Gear VDP fix.
      That's a tricky system to get good technical information on. The fix
      should be correct, but please report if you spot any regressions just in
  17. 12 Aug, 2017 2 commits
    • Screwtape's avatar
      Update to v104 public release. · 0034adab
      Screwtape authored
      [As mentioned in the v104 internal release notes, byuu fixed a small typo in
      the GBA core. -Ed.]
      byuu says:
      There are lots of improvements in this new release, both to core
      emulation and to the user interface. However, some of these changes are
      quite substantial, so regressions are a possibility. Please report any
      regressions from v103 on the forums if found.
      Note that Mega Drive save RAM files will not be compatible with v103,
      but will now be compatible with save RAM files from all other Mega Drive
      emulators, and the format will be stable going forward.
      Also!! Thanks to the tireless work of Screwtape, the
      Help->Documentation link in higan now takes you to a very comprehensive
      user guide. Please be sure to consult this if you have any questions
      about using higan.
      Lastly, I've added a link to my Patreon page (https://patreon.com/byuu/)
      to the higan downloads page. The money will go exclusively toward
      purchasing SNES games for preservation, hardware and flash carts for
      reverse engineering, equipment such as backup drives, etc. Donating is
      entirely optional and comes with no rewards, but would of course be
      greatly appreciated! ^^;
      Changelog (since v103):
        - nall/dsp: improved first-order IIR filtering
        - Famicom: improved audio filtering (90hz lowpass + 440hz lowpass +
          14khz highpass)
        - Game Boy Advance: corrected bug in PSG wave channel emulation
        - Mega Drive: added first-order 2.84KHz low-pass filter to match VA6
          model hardware
        - Mega Drive: lowered PSG volume relative to YM2612 to match VA6 model
        - Mega Drive: Hblank flag is not always set during Vblank
        - Mega Drive: fix PAL mode reporting from control port reads
        - Famicom: improved phase duty cycle emulation (mode 3 is 25% phase
          inverted; counter decrements)
        - Mega Drive: reset does not cancel 68K bus requests
        - Mega Drive: 68K is not granted bus access on Z80 reset
        - Mega Drive: CTRL port is now read-write, maintains value across
          controller changes
        - Z80: IX, IY override mode can now be serialized in save states
        - 68K: fixed calculations for ABCD, NBCD, SBCD [hex\_usr,
        - SPC700: improved all cycle timings to match results observed by
          Overload with a logic anaylzer
        - Super Famicom: SMP uses a separate 4x8-bit buffer for $f4-f7; not
          APU RAM [hex\_usr]
        - Super Famicom: SMP TEST register is now finally 100% fully emulated
          [byuu, AWJ]
        - Game Boy Advance: DMA can run between CPU instruction cycles
        - Game Boy Advance: added 2-cycle delay between DMA activation and
        - higan: improved aspect ratio correction accuracy at higher video
          scaling sizes
        - higan: overscan masking will now actually crop the underlying video
          instead of just blanking it
        - Mega Drive: center video when overscan is disabled
        - higan: added increment/decrement quick save slot hotkeys
        - Game Boy Advance: fixed wave RAM nibble ordering (fixes audio in
          Castlevania, Pocket NES)
        - higan: added new adaptive windowed mode: resizes the window to the
          current emulated system's size
        - higan: added new integral scaling mode: resizes the window to fill
          as much of the screen as possible
        - higan: main window is now resizable and will automatically scale
          contents based on user settings
        - higan: fixed one-time blinking of the main window on startup caused
          by focus stealing bug
        - ruby: fixed major memory leak in Direct3D driver
        - ruby: added fullscreen exclusive mode to Direct3D driver
        - Super Famicom: corrected latching behavior of BGnHOFS PPU registers
        - higan: all windows sans the main viewport can be dismissed with the
          escape key now
        - ruby: complete API rewrite; many audio drivers now support device
        - higan: output frequency can now be modified
        - higan: configuration settings split to individual menu options for
          faster access to individual pages
        - ruby: improved WASAPI driver to event-driven model; more compatible
          in exclusive mode now
        - libco: fix compilation of sjlj and fiber targets [Screwtape]
        - ruby: added YV12 and I420 support to X-Video driver
        - Game Boy: added TAMA emulation (RTC emulation is not working yet)
          [thanks to endrift for notes]
        - Game Boy: correct data ordering of MMM01 ROMs (MMM01 ROMs will need
          to be re-imported into higan)
        - Game Boy: store MBC2 save RAM as 256-bytes instead of 512-bytes (RAM
          is 4-bit; not 8-bit with padding)
        - Game Boy: fixed a bug with RAM serialization in games without a
        - Mega Drive: fix CRAM reads (fixes Sonic Spinball) [hex\_usr]
        - Game Boy: added rumble support to MBC5 games such as Pokemon Pinball
        - Game Boy: added MBC7 emulation (accelerometer X-axis, EEPROM not
          working yet) [thanks to endrift for notes]
        - hiro: macOS compilation fixes and UI improvements [MerryMage,
        - Game Boy: added MBC6 emulation (no phone link or flash support;
          timing bugs in game still)
        - Game Boy: HDMA syncs to other components after each byte transfer
        - Game Boy: disabling the LCD completely halts the PPU (fixes onscreen
          graphical corruption in some games)
        - Mega Drive: added 6-button Fighting Pad emulation [hex\_usr]
        - 68K: TAS sets d7 when EA mode is a direct register (fixes Asterix
          graphical corruption)
        - Game Boy: STAT mode is forced to zero when LCD is disabled (fixes
          Pokemon Pinball)
        - LR35902: complete rewrite
        - icarus: high-DPI is not supported on Windows yet; remove setting for
          consistency with higan window sizes
        - hiro: added full support for high-DPI displays on macOS [ncbncb]
        - ARM7TDMI: complete rewrite
        - Super Famicom: disabled channels during HDMA initialization appear
          to set DoTransfer flag
        - V30MZ: code cleanup
        - Mega Drive: added optional TMSS emulation; disabled by default
        - ARM7TDMI: pipeline decode stage caches CPSR.T [MerryMage]
        - ARM7TDMI: fixed timing of THUMB stack multiple instruction
        - higan: detect when ruby drivers crash; disable drivers on next
          startup to prevent crash loop
        - Mega Drive: added automatic region detection (favors NTSC-J >
          NTSC-U > PAL) [hex\_usr]
        - Mega Drive: support 8-bit SRAM
        - ARM7TDMI: PC should be incremented by 2 when setting CPSR.T via MSR
          instruction [MerryMage]
        - ruby: add Windows ASIO driver support (does not work on some systems
          due to buggy vendor drivers)
        - higan: default to safe drivers on a new install; due to instability
          with some optimal drivers
    • Screwtape's avatar
      Update to v104 release. · ba384a7c
      Screwtape authored
      byuu says:
        - emulator/interface: removed unused Region struct
        - gba/cpu: optimized CPU::step() as much as I could for a slight
        - gba/cpu: synchronize the APU better during FIFO updates
        - higan/md, icarus: add automatic region detection; make it the
          default option [hex\_usr]
            - picks NTSC-J if there's more than one match ... eventually, this
              will be a setting
        - higan/md, icarus: support all three combinations of SRAM (8-bit low,
          8-bit high, 16-bit)
        - processor/arm7tdmi: fix bug when changing to THUMB mode via MSR
        - tomoko: redesigned crash detector to only occur once for all three
          ruby drivers
            - this will reduce disk thrashing since the configuration file
              only needs to be written out one extra time
            - technically, it's twice ... but we should've always been writing
              one out on first run in case it crashes then
        - tomoko: defaulted back to the safest ruby drivers, given the optimal
          drivers have some stability concerns
      ¹: minor errata: spotted a typo saying `synchronize(cpu)` when the CPU
      is stopped, instead of `synchronize(ppu)`. This will be fixed in the v104
      official 7zip archives.
      I'm kind of rushing here but, it's really good timing for me to push out
      a new official release. The blocking issues are resolved or close to it,
      and we need lots of testing of the new major changes.
      I'm going to consider this a semi-stable testing release and leave links
      to v103 just in case.
  18. 11 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r32 release. · 55f19c3e
      Screwtape authored
      byuu says:
        - Master System: merged Bus into CPU
        - Mega Drive: merged BusCPU into CPU; BusAPU into AU
        - Mega Drive: added TMSS emulation; disabled by default [hex\_usr]
            - VDP lockout not yet emulated
        - processor/arm7tdmi: renamed interrupt() to exception()
        - processor/arm7tdmi: CPSR.F (FIQ disable) flag is set on reset
        - processor/arm7tdmi: pipeline decode stage caches CPSR.T (THUMB mode)
            - fixes `msr_tests.gba` test F
        - processor/arm7tdmi/disassembler: add PC address to left of currently
          executing instruction
        - processor/arm7tdmi: stop forcing CPSR.M (mode flags) bit 4 high (I
          don't know what really happens here)
        - processor/arm7tdmi: undefined instructions now generate Undefined
          0x4 exception
        - processor/arm7tdmi: thumbInstructionAddRegister masks PC by &~3
          instead of &~2
            - hopefully this is correct; &~2 felt very wrong
        - processor/arm7tdmi: thumbInstructionStackMultiple can use sequential
          timing for PC/LR PUSH/POP [Cydrak]
        - systems/Mega Drive.sys: added tmss.rom; enable with cpu version=1
        - tomoko: detect when a ruby video/audio/input driver crashes higan;
          disable it on next program startup
      v104 blockers:
        - Mega Drive: support 8-bit SRAM (even if we don't support 16-bit;
          don't force 8-bit to 16-bit)
        - Mega Drive: add region detection support to icarus
        - ruby: add default audio device information so certain drivers won't
          default to silence out of the box
  19. 10 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r31 release. · 406b6a61
      Screwtape authored
      byuu says:
        - gba/cpu: slight speedup to CPU::step()
        - processor/arm7tdmi: fixed about ten bugs, ST018 and GBA games are
          now playable once again
        - processor/arm: removed core from codebase
        - processor/v30mz: code cleanup (renamed functions; updated
          instruction() for consistency with other cores)
      It turns out on my much faster system, the new ARM7TDMI core is very
      slightly slower than the old one (by about 2% or so FPS.) But the
      CPU::step() improvement basically made it a wash.
      So yeah, I'm in really serious trouble with how slow my GBA core is now.
      As for higan/processor ... this concludes the first phase of major
      cleanups and rewrites.
      There will always be work to do, and I have two more phases in mind.
      One is that a lot of the instruction disassemblers are very old. One
      even uses sprintf still. I'd like to modernize them all. Also, the
      ARM7TDMI core (and the ARM core before it) can't really disassemble
      because the PC address used for instruction execution is not known prior
      to calling instruction(), due to pipeline reload fetches that may occur
      inside of said function. I had a nasty hack for debugging the new core,
      but I'd like to come up with a clean way to allow tracing the new
      ARM7TDMI core.
      Another is that I'd still like to rename a lot of instruction function
      names in various cores to be more descriptive. I really liked how the
      LR35902 core came out there, and would like to get that level of detail
      in with the other cores as well.
  20. 09 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r30 release. · 10675668
      Screwtape authored
      byuu says:
        - processor/arm7tdmi: completed implemented
        - gba/cpu, sfc/coprocessor/armdsp: use arm7tdmi instead of arm
        - sfc/cpu: experimental fix for newly discovered HDMA emulation issue
      The ARM7TDMI core crashes pretty quickly when trying to run GBA games,
      and I'm certain the same will be the case with the ST018. It was never
      all that likely I could rewrite 70KiB of code in 20 hours and have it
      work perfectly on the first try. So, now it's time for lots and lots of
      debugging. Any help would *really* be appreciated, if anyone were up for
      comparing the two implementations for regressions =^-^= I often have a
      really hard time spotting simple typos that I make.
      Also, the SNES HDMA fix is temporary. I would like it if testers could
      run through a bunch of games that are known for being tricky with HDMA
      (or if these aren't known to said tester, any games are fine then.) If
      we can confirm regressions, then we'll know the fix is either incorrect
      or incomplete. But if we don't find any, then it's a good sign that
      we're on the right path.
  21. 08 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r29 release. · 559eeccc
      Screwtape authored
      byuu says:
        - processor/arm7tdmi: implementation all nine remaining ARM
        - processor/arm7tdmi: implemented five more THUMB instructions
          (sixteen remain)
  22. 07 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r28 release. · a72ff8b7
      Screwtape authored
      byuu says:
        - processor/arm7tdmi: implemented 10 of 19 ARM instructions
        - processor/arm7tdmi: implemented 1 of 22 THUMB instructions
      Today's WIP was 6 hours of work, and yesterday's was 5 hours.
      Half of today was just trying to come up with the design to use a
      lambda-based dispatcher to map both instructions and disassembly,
      similar to the 68K core. The problem is that the ARM core has 28 unique
      bits, which is just far too many bits to have a full lookup table like
      the 16-bit 68K core.
      The thing I wanted more than anything else was to perform the opcode
      bitfield decoding once, and have it decoded for both instructions and
      the disassembler. It took three hours to come up with a design that
      worked for the ARM half ... relying on #defines being able to pull in
      other #defines that were declared and changed later after the first
      one. But, I'm happy with it. The decoding is in the table building, as
      it is with the 68K core. The decoding does happen at run-time on each
      instruction invocation, but it has to be done.
      As to the THUMB core, I can create a 64K-entry lambda table to cover all
      possible encodings, and ... even though it's a cache killer, I've
      decided to go for it, given the outstanding performance it obtained in
      the M68K core, as well as considering that THUMB mode is far more common
      in GBA games.
      As to both cores ... I'm a little torn between two extremes:
      On the one hand, I can condense the number of ARM/THUMB instructions
      further to eliminate more redundant code. On the other, I can split them
      apart to reduce the number of conditional tests needed to execute each
      instruction. It's really the disassembler that makes me not want to
      split them up further ... as I have to split the disassembler functions
      up equally to the instruction functions. But it may be worth it if it's
      a speed improvement.
  23. 06 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r27 release. · 0b6f1df9
      Screwtape authored
      byuu says:
        - hiro/windows: set dpiAware=false, fixes icarus window sizes relative
          to higan window sizes
        - higan, icarus, hiro, ruby: add support for high resolution displays
          on macOS [ncbncb]
        - processor/lr35902-legacy: removed
        - processor/arm7tdmi: new processor core started; intended to one day
          be a replacement for processor/arm
      It will probably take several WIPs to get the new ARM core up and
      running. It's the last processor rewrite. After this, all processor
      cores will be up to date with all my current programming conventions.
  24. 05 Aug, 2017 1 commit
    • Screwtape's avatar
      Update to v103r26 release. · 020caa54
      Screwtape authored
      byuu says:
        - processor/lr35902: completed rewrite
      I'd appreciate regression testing of the Game Boy and Game Boy Color
      emulation between v103r24 and v103r26 (skip r25) if anyone wouldn't
      I fixed up processor/lr35902-legacy to compile and run, so that trace
      logs can be created between the two cores to find errors. I'm going to
      kill processor/lr35902-legacy with the next WIP release, as well as make
      changes to the trace format (add flags externally from AF; much easier
      to read them that way), which will make it more difficult to do these
      comparisons in the future, hence r26 may prove important later on if we
      miss regressions this time.
      As for the speed of the new CPU core, not too much to report ... at
      least it's not slower :)
          Mega Man II: 212.5 to 214.5fps
          Shiro no Sho: 191.5 to 191.5fps
          Oracle of Ages: 182.5 to 190.5fps
  25. 04 Aug, 2017 2 commits
    • Screwtape's avatar
      Update to v103r25 release. · c2975e68
      Screwtape authored
      byuu says:
        - gb/cpu: force STAT mode to 0 when LCD is disabled (fixes Pokemon
          Pinball, etc)
        - gb/ppu: when LCD is disabled, require at least one-frame wait to
          re-enable, display white during this time
            - todo: should step by a scanline at a time: worst-case is an
              extra 99% of a frame to enable again
        - gba/ppu: cache tilemap lookups and attribute parsing
            - it's more accurate because the GBA wouldn't read this for every
            - but unfortunately, this didn't provide any speedup at all ...
        - ruby/audio/alsa: fixed const issue with free()
        - ruby/video/cgl: removed `glDisable(GL_ALPHA_TEST)` [deprecated]
        - ruby/video/cgl: removed `glEnable(GL_TEXTURE_2D)` [unnecessary as
          we use shaders]
        - processor/lr35902: started rewrite¹
      ¹: so, the Game Boy and Game Boy Color cores will be completely
      broken for at least the next two or three WIPs.
      The old LR35902 was complete garbage, written in early 2011. So I'm
      rewriting it to provide a massive cleanup and consistency with other
      processor cores, especially the Z80 core.
      I've got about 85% of the main instructions implemented, and then I have
      to do the CB instructions. The CB instructions are easier because
      they're mostly just a small number of opcodes in many small variations,
      but it'll still be tedious.
    • Screwtape's avatar
      Update to v103r24 release. · 571760c7
      Screwtape authored
      byuu says:
        - gb/mbc6: mapper is now functional, but Net de Get has some text
        - gb/mbc7: mapper is now functional²
        - gb/cpu: HDMA syncs other components after each byte transfer now
        - gb/ppu: LY,LX forced to zero when LCDC.d7 is lowered (eg disabled),
          not when it's raised (eg enabled)
        - gb/ppu: the LCD does not run at all when LCDC.d7 is clear³
            - fixes graphical corruption between scene transitions in Legend
              of Zelda - Oracle of Ages
            - thanks to Cydrak, Shonumi, gekkio for their input on the cause
              of this issue
        - md/controller: renamed "Gamepad" to "Control Pad" per official
        - md/controller: added "Fighting Pad" (6-button controller) emulation
        - processor/m68k: fixed TAS to set data.d7 when
          EA.mode==DataRegisterDirect; fixes Asterix
        - hiro/windows: removed carriage returns from mouse.cpp and
        - ruby/audio/alsa: added device driver selection [SuperMikeMan]
        - ruby/audio/ao: set format.matrix=nullptr to prevent a crash on some
          systems [SuperMikeMan]
        - ruby/video/cgl: rename term() to terminate() to fix a crash on macOS
      ¹: The observation that this mapper split $4000-7fff into two banks
      came from MAME's implementation. But their implementation was quite
      broken and incomplete, so I didn't actually use any of it. The
      observation that this mapper split $a000-bfff into two banks came from
      Tauwasser, and I did directly use that information, plus the knowledge
      that $0400/$0800 are the RAM bank select registers.
      The text corruption is due to a race condition with timing. The game is
      transferring font letters via HDMA, but the game code ends up setting
      the bank# with the font a bit too late after the HDMA has already
      occurred. I'm not sure how to fix this ... as a whole, I assumed my Game
      Boy timing was pretty good, but apparently it's not that good.
      ²: The entire design of this mapper comes from endrift's notes.
      endrift gets full credit for higan being able to emulate this mapper.
      Note that the accelerometer implementation is still not tested, and
      probably won't work right until I tweak the sensitivity a lot.
      ³: So the fun part of this is ... it breaks the strict 60fps rate of
      the Game Boy. This was always inevitable: certain timing conditions can
      stretch frames, too. But this is pretty much an absolute deal breaker
      for something like Vsync timing. This pretty much requires adaptive sync
      to run well without audio stuttering during the transition.
      There's currently one very important detail missing: when the LCD is
      turned off, presumably the image on the screen fades to white. I do not
      know how long this process takes, or how to really go about emulating
      it. Right now as an incomplete patch, I'm simply leaving the last
      displayed image on the screen until the LCD is turned on again. But I
      will have to output white, as well as add code to break out of the
      emulation loop periodically when the LCD is left off eg indefinitely, or
      bad things would happen. I'll work something out and then implement.
      Another detail is I'm not sure how long it takes for the LCD to start
      rendering again once enabled. Right now, it's immediate. I've heard it's
      as long as 1/60th of a second, but that really seems incredibly
      excessive? I'd like to know at least a reasonably well-supported
      estimate before I implement that.
  26. 30 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r23 release. · 7022d1aa
      Screwtape authored
      byuu says:
        - gb: added accelerometer X-axis, Y-Axis inputs¹
        - gb: added rumble input¹
        - gb/mbc5: added rumble support²
        - gb/mbc6: added skeleton driver, but it doesn't boot Net de Get
        - gb/mbc7: added mostly complete driver (only missing EEPROM), but it
          doesn't boot Kirby Tilt 'n' Tumble
        - gb/tama: added leap year assignment
        - tomoko: fixed macOS compilation [MerryMage]
        - hiro/cocoa: fix table cell redrawing on updates and automatic column
          resizing [ncbncb]
        - hiro/cocoa: fix some weird issue with clicking table view checkboxes
          on Retina displays [ncbncb]
        - icarus: enhance Game Boy heuristics³
        - nall: fix three missing return statements [Jonas Quinn]
        - ruby: hopefully fixed all compilation errors reported by Screwtape
          et al⁴
      ¹: because there's no concept of a controller for cartridge inputs,
      I'm attaching to the base platform for now. An idea I had was to make
      separate ports for each cartridge type ... but this would duplicate the
      rumble input between MBC5 and MBC7. And would also be less discoverable.
      But it would be more clean in that users wouldn't think the Game Boy
      hardware had this functionality. I'll think about it.
      ²: it probably won't work yet. Rumble isn't documented anywhere, but
      I dug through an emulator named GEST and discovered that it seems to use
      bit 3 of the RAM bank select to be rumble. I don't know if it sets the
      bit for rumbling, then clears when finished, or if it sets it and then
      after a few milliseconds it stops rumbling. I couldn't test on my
      FreeBSD box because SDL 1.2 doesn't support rumble, udev doesn't exist
      on FreeBSD, and nobody has ever posted any working code for how to use
      evdev (or whatever it's called) on FreeBSD.
      ³: I'm still thinking about specifying the MBC7 RAM as EEPROM, since
      it's not really static RAM.
      ⁴: if possible, please test all drivers if you can. I want to ensure
      they're all working. Especially let me know if the following work:
      macOS: input.carbon Linux: audio.pulseaudiosimple, audio.ao (libao)
      If I can confirm these are working, I'm going to then remove them from
      being included with stock higan builds.
      I'm also considering dropping SDL video on Linux/BSD. XShm is much
      faster and supports blurring. I may also drop SDL input on Linux, since
      udev works better. That will free a dependency on SDL 1.2 for building
      higan. FreeBSD is still going to need it for joypad support, however.
  27. 28 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r22 release. · e1223366
      Screwtape authored
      byuu says:
        - ruby: ported all remaining drivers to new API¹
        - ruby/wasapi: fix for dropping one sample per period [SuperMikeMan]
        - gb: emulated most of the TAMA RTC; but RTC state is still volatile²
      ¹: the new ports are:
        - audio/{directsound, alsa, pulseaudio, pulseaudiosimple, ao}
        - input/{udev, quartz, carbon}
      It's pretty much guaranteed many of them will have compilation errors.
      Please paste the error logs and I'll try to fix them up. It may take a
      WIP or two to get there.
      It's also possible things broke from the updates. If so, I could use
      help comparing the old file to the new file, looking for mistakes, since
      I can't test on these platforms apart from audio/directsound.
      Please report working drivers in this list, so we can mark them off the
      list. I'll need both macOS and Linux testers.
          if(DirectSoundCreate(0, &_interface, 0) != DS_OK) return terminate(), false;
      ²: once I get this working, I'll add load/save support for the RTC
      values. For now, the RTC data will be lost when you close the emulator.
      Right now, you can set the date/time in real-time mode, and when you
      start the game, the time will be correct, and the time will tick
      forward. Note that it runs off emulated time instead of actual real
      time, so if you fast-forward to 300%, one minute will be 20 seconds.
      The really big limitation right now is that when you exit the game, and
      restart it, and resume a new game, the hour spot gets corrupted, and
      this seems to instantly kill your pet. Fun. This is crazy because the
      commands the game sends to the TAMA interface are identical between
      starting a new game and getting in-game versus loading a game.
      It's likely going to require disassembling the game's code and seeing
      what in the hell it's doing, but I am extremely bad at LR35092 assembly.
      Hopefully endrift can help here :|
  28. 26 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r21 release. · 80841dea
      Screwtape authored
      byuu says:
        - gb: added TAMA emulation [thanks to endrift for the initial notes]
        - gb: save RTC memory to disk (MBC3 doesn't write to said memory yet;
          TAMA doesn't emulate it yet)
        - gb: expect MMM01 boot loader to be at end of ROM instead of start
        - gb: store MBC2 save RAM as 256-bytes (512x4-bit) instead of
          512-bytes (with padding)
        - gb: major cleanups to every cartridge mapper; moved to Mapper class
          instead of MMIO class
        - gb: don't serialize all mapper states with every save state; only
          serialize the active mapper
        - gb: serialize RAM even if a battery isn't present¹
        - gb/cartridge: removed unnecessary code; refactored other code to
          eliminate duplication of functions
        - icarus: improve GB(C) heuristics generation to not include filenames
          for cartridges without battery backup
        - icarus: remove incorrect rearrangement of MMM01 ROM data
        - md/vdp: fix CRAM reads -- fixes Sonic Spinball colors [hex\_usr]
        - tomoko: hide the main higan window when entering fullscreen
          exclusive mode; helps with multi-monitor setups
        - tomoko: destroy ruby drivers before calling Application::quit()
        - libco: add settings.h and defines to fiber, ucontext [Screwtape]
      ¹: this is one of those crystal clear indications that nobody's
      actually playing the higan DMG/CGB cores, or at least not with save
      states. This was a major mistake.
      Note: I can't find any official documentation that `GL_ALPHA_TEST` was
      removed from OpenGL 3.2. Since it's not hurting anything except showing
      some warnings in debug mode, I'm just going to leave it there for now.
  29. 24 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r20 release. · d5c09c9a
      Screwtape authored
      byuu says:
        - ruby/audio/xaudio2: ported to new ruby API
        - ruby/video/cgl: ported to new ruby API (untested, won't compile)
        - ruby/video/directdraw: ported to new ruby API
        - ruby/video/gdi: ported to new ruby API
        - ruby/video/glx: ported to new ruby API
        - ruby/video/wgl: ported to new ruby API
        - ruby/video/opengl: code cleanups
      The macOS CGL driver is sure to have compilation errors. If someone will
      post the compilation error log, I can hopefully fix it in one or two
      iterations of WIPs.
      I am unable to test the Xorg GLX driver, because my FreeBSD desktop
      video card drivers do not support OpenGL 3.2. If the driver doesn't
      work, I'm going to need help tracking down what broke from the older
      The real fun is still yet to come ... all the Linux-only drivers, where
      I don't have a single Linux machine to test with.
        - libco/fiber
        - libco/ucontext (I should really just delete this)
        - tomoko: hide main UI window when in exclusive fullscreen mode
  30. 23 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r19 release. · 8be474b0
      Screwtape authored
      byuu says:
        - tomoko: Application::onMain assigned at end of Program::Program()
        - libco: add `#define _XOPEN_SOURCE 500` to fix compilation of sjlj.c
        - ruby/audio/openal: fixed device driver string list enumeration
        - ruby/audio/wasapi: changing device re-initializes the driver now
        - ruby/audio/wasapi: probably a pointless change, but don't fill the
          buffer beyond the queue size with silence
        - ruby/video/xvideo: renamed from ruby/video/xv
        - ruby/video/xvideo: check to see if `XV_AUTOPAINT_COLORKEY` exists
          before setting it [SuperMikeMan]
        - ruby/video/xvideo: align buffer sizes to be evenly divisible by four
        - ruby/video/xvideo: fail nicely without crashing (hopefully)
        - ruby/video/xvideo: add support for YV12 and I420 12-bit planar YUV
      ¹: prevents crashes when drivers fail to initialize from running the
      main loop that polls input drivers before the input driver is
      initialized (or fails to initialize itself.) Some drivers still don't
      block their main functions when initialization fails, so they will still
      crash, but I'll work to fix them.
      ²: this was a **major** pain in the ass, heh. You only get one chroma
      sample for every four luma samples, so the color reproduction is even
      worse than UYVY and YUYV (which is two to four chroma to luma.) Further,
      the planar format took forever to figure out. Apparently it doesn't care
      what portion of the image you specify in XvShmPutImage, it expects you
      to use the buffer dimensions to locate the U and V portions of the data.
      This is probably the most thorough X-Video driver in existence now.
        - forgot to rename the configuration settings dialog window title to
          just "Settings"
  31. 20 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r18 release. · 284e4c04
      Screwtape authored
      byuu says:
        - tomoko: improved handling of changing audio devices on the audio
          settings panel
        - ruby/audio/wasapi: added device enumeration and selection support¹
        - ruby/audio/wasapi: release property store handle from audio device
        - ruby/audio/wasapi: fix exclusive mode buffer filling
        - ruby/video/glx2: ported to new API -- tested and confirmed working
        - ruby/video/sdl: fixed initialization -- tested and confirmed working
          on FreeBSD now³
        - ruby/video/xv: ported to new API -- tested and mostly working great,
          sans fullscreen mode⁴
        - accidentally changed "Driver Settings" label to "Driver" on the
          audio settings tab because I deleted the line and forgot the
          "Settings" part
        - need to use "return initialize();" from setDevice() in the WASAPI
          driver, instead of "return true;", so device selection is currently
          not functioning in this WIP for said driver
      ¹: for now, this will likely end up selecting the first available
      endpoint device, which is probably wrong. I need to come up with a
      system to expose good 'default values' when selecting new audio drivers,
      or changing audio device settings.
      ²: glx2 is a fallback driver for system with only OpenGL 2.0 and no
      OpenGL 3.2 drivers, such as FreeBSD 10.1 with AMD graphics cards.
      ³: although I really should track down why InputManager::poll() is
      crashing the emulator when Video::ready() returns false ...
      ⁴: really bizarrely, when entering fullscreen mode, it looks like the
      image was a triangle strip, and the bottom right triange is missing, and
      the top left triangle skews the entire image into it. I'm suspecting
      this is a Radeon driver bug when trying to create a 2560x1600 X-Video
      surface. The glitch persists when exiting fullscreen, too.
      If anyone can test the X-Video driver on their Linux/BSD system, it'd be
      appreciated. If it's just my video card, I'll ignore it. If not,
      hopefully someone can find the cause of the issue :|
  32. 19 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r17 release. · 0b4e7fb5
      Screwtape authored
      byuu says:
        - tomoko: re-hid the video sync option¹
        - tomoko: removed " Settings" duplication on all the individual
          settings tab options
        - ruby/audio/wasapi: finished port to new syntax; adapted to an
          event-driven model; support 32-bit integral audio²
        - ruby/video/sdl: ported to new syntax; disabled driver on FreeBSD³
      ¹: still contemplating a synchronize submenu of {none, video, audio},
      but ... the fact that video can't work on PAL, WonderSwan games is a
      real limitation for it
      ²: this driver actually received a ton of work. There's also a new
      ring-buffer queue, and I added special handling for when exclusive mode
      fails because the latency requested is lower than the hardware can
      support. It'll pick the closest latency to the minimum that is possible
      in this case.
      On my Audigy Rx, the results for non-exclusive mode are the same. For
      exclusive mode, the framerate drops from 60fps to ~50fps for smaller
      buffers, and ~55fps for larger buffers (no matter how big, it never hits
      60fps.) This is a lot better than before where it was hitting ~15fps,
      but unfortunately it's the best I can do.
      The event system used by WASAPI is really stupid. It just uses SetEvent
      at some arbitrary time, and you have to query to see how many samples
      it's waiting on. This makes it unknowable how many samples we should
      buffer before calling `WaitForSingleObject(INFINITE)`, and it's also
      unclear how we should handle cases where there's more samples available
      than our queue has: either we can fill it with zeroes, or we can write
      less samples. The former should prevent audio looping effects when
      running too slowly, whereas the latter could potentially be too
      ambitious when the audio could've recovered from a minor stall.
      It's shocking to me how there's as many ways to send audio to a sound
      card as there are sound card APIs, when all that's needed is a simple
      double buffer and a callback event from another thread to do it right.
      It's also terrifying how unbelievably shitty nearly all sound card
      drivers apparently are.
      Also, I don't know if cards can output an actual 24-bit mode with three
      byte audio samples, or if they always just take 32-bit samples and
      ignore the lower 8-bits. Whatever, it's all nonsense for the final
      output to be >16-bits anyway (hi, `double[]` input from ruby.)
      ³: unfortunately, this driver always crashes on FreeBSD (even before
      the rewrite), so I'll need someone on Linux to test it and make sure it
      actually works. I'll also need testing for a lot of the other drivers as
      well, once they're ported over (I don't have X-video, PulseAudio, ALSA,
      or udev.)
      Note that I forgot to set `_ready=true` at the end of `initialize()`,
      and `_ready=false` in `terminate()`, but it shouldn't actually matter
      beyond showing you a false warning message on startup about it failing
      to initialize.
  33. 17 Jul, 2017 2 commits
    • Screwtape's avatar
      Update to v103r16 release. · f87c6b7e
      Screwtape authored
      byuu says:
        - emulator/audio: added the ability to change the output frequency at
          run-time without emulator reset
        - tomoko: display video synchronize option again¹
        - tomoko: Settings→Configuration expanded to Settings→{Video,
          Audio, Input, Hotkey, Advanced} Settings²
        - tomoko: fix default population of audio settings tab
        - ruby: Audio::frequency is a double now (to match both
          Emulator::Audio and ASIO)³
        - tomoko: changing the audio device will repopulate the frequency and
          latency lists
        - tomoko: changing the audio frequency can now be done in real-time
        - ruby/audio/asio: added missing device() information, so devices can
          be changed now
        - ruby/audio/openal: ported to new API; added device selection support
        - ruby/audio/wasapi: ported to new API, but did not test yet (it's
          assuredly still broken)⁴
      ¹: I'm uneasy about this ... but, I guess if people want to disable
      audio and just have smooth scrolling video ... so be it. With
      Screwtape's documentation, hopefully that'll help people understand that
      video synchronization always breaks audio synchronization. I may change
      this to a child menu that lets you pick between {no synchronization,
      video synchronization, audio synchronization} as a radio selection.
      ²: given how much more useful the video and audio tabs are now, I
      felt that four extra menu items were worth saving a click and going
      right to the tab you want. This also matches the behavior of the Tools
      menu displaying all tool options and taking you directly to each tab.
      This is kind of a hard change to get used to ... but I think it's for
      the better.
      ³: kind of stupid because I've never seen a hardware sound card where
      floor(frequency) != frequency, but whatever. Yay consistency.
      ⁴: I'm going to move it to be event-driven, and try to support 24-bit
      sample formats if possible. Who knows which cards that'll fix and which
      cards that'll break. I may end up making multiple WASAPI drivers so
      people can find one that actually works for them. We'll see.
    • Screwtape's avatar
      Update to v103r15 release. · 4129630d
      Screwtape authored
      byuu says:
        - ruby: rewrote the API interfaces for Video, Audio, Input
        - ruby/audio: can now select the number of output channels (not useful
          to higan, sorry)
        - ruby/asio: various improvements
        - tomoko: audio settings panel can now select separate audio devices
          (for ASIO, OSS so far)
        - tomoko: audio settings panel frequency and latency lists are
          dynamically populated now
      Note: due to the ruby API rewrite, most drivers will not compile. Right
      now, the following work:
        - video: Direct3D, XShm
        - audio: ASIO, OSS
        - input: Windows, SDL, Xlib
      It takes a really long time to rewrite these (six hours to do the
      above), so it's going to be a while before we're back at 100%
      functionality again.
        - ASIO needs device(), setDevice()
        - need to call setDevice() at program startup to populate
          frequency/latency settings properly
        - changing the device and/or frequency needs to update the emulator
          resampler rates
      The really hard part is going to be the last one: the only way to change
      the emulator frequency is to flush all the audio streams and then
      recompute all the coefficients for the resamplers. If this is called
      during emulation, all audio streams will be erased and thus no sound
      will be output. I'll most likely be forced to simply ignore
      device/frequency changes until the user loads another game. It is at
      least possible to toggle the latency dynamically.
  34. 15 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r14 release. · 17697317
      Screwtape authored
      byuu says:
        - tomoko: by popular choice, default to adaptive mode on new installs
        - hiro/windows: fix bug that was preventing the escape key from
          closing some dialog windows
        - nall/registry: use "\\\\" as separator instead of "/" ... because
          some registry keys contain "/" in them >_>
        - ruby: add ASIO driver stub (so far it can only initialize and grab
          the driver name/version information)
  35. 12 Jul, 2017 1 commit
    • Screwtape's avatar
      Update to v103r13 release. · ed5ec585
      Screwtape authored
      byuu says:
        - gb/interface: fix Game Boy Color extension to be "gbc" and not "gb"
        - ms/interface: move Master System hardware controls below controller
        - sfc/ppu: improve latching behavior of BGnHOFS registers (not
          hardware verified) [AWJ]
        - tomoko/input: rework port/device mapping to support non-sequential
          ports and devices¹
            - todo: should add move() to inputDevice.mappings.append and
            - note: there's a weird GCC 4.9 bug with brace initialization of
              InputEmulator; have to assign each field separately
        - tomoko: all windows sans the main presentation window can be
          dismissed with the escape key
        - icarus: the single file selection dialog ("Load ROM Image...") can
          be dismissed with the escape key
        - tomoko: do not pause emulation when FocusLoss/Pause is set during
          exclusive fullscreen mode
        - hiro/(windows,gtk,qt): implemented Window::setDismissable() function
          (missing from cocoa port, sorry)
        - nall/string: fixed printing of largest possible negative numbers (eg
          `INT_MIN`) [Sintendo]
            - only took eight months! :D
      ¹: When I tried to move the Master System hardware port below the
      controller ports, I ran into a world of pain.
      The input settings list expects every item in the
      `InputEmulator<InputPort<InputDevice<InputMapping>>>>` arrays to be
      populated with valid results. But these would be sparsely populated
      based on the port and device IDs from inside higan. And that is done so
      that the Interface::inputPoll can have O(1) lookup of ports and devices.
      This worked because all the port and device IDs were sequential (they
      left no gaps in the maps upon creating the lists.)
      Unfortunately by changing the expectation of port ID to how it appears
      in the list, inputs would not poll correctly. By leaving them alone and
      just moving Hardware to the third position, the Game Gear would be
      missing port IDs of 0 and 1 (the controller ports of the Master System).
      Even by trying to make separate MasterSystemHardware and
      GameGearHardware ports, things still fractured when the devices were no
      longer contigious.
      I got pretty sick of this and just decided to give up on O(1)
      port/device lookup, and moved to O(n) lookup. It only knocked the
      framerate down by maybe one frame per second, enough to be in the margin
      of error. Inputs aren't polled *that* often for loops that usually
      terminate after 1-2 cycles to be too detrimental to performance.
      So the new input system now allows non-sequential port and device IDs.
      Remember that I killed input IDs a while back. There's never any reason
      for those to need IDs ... it was easier to just order the inputs in the
      order you want to see them in the user interface. So the input lookup is
      still O(1). Only now, everything's safer and I return a
      maybe<InputMapping&>, and won't crash out the program trying to use a
      mapping that isn't found for some reason.
      Errata: the escape key isn't working on the browser/message dialogs on
      Windows, because of course nothing can ever just be easy and work for
      me. If anyone else wouldn't mind looking into that, I'd greatly
      appreciate it.
      Having the `WM_KEYDOWN` test inside the main `Application_sharedProc`, it
      seems to not respond to the escape key on modal dialogs. If I put the
      `WM_KEYDOWN` test in the main window proc, then it doesn't seem to get
      called for `VK_ESCAPE` at all, and doesn't get called period for modal
      windows. So I'm at a loss and it's past 4AM here >_>