Commit graph

909 commits

Author SHA1 Message Date
Tyler J. Stachecki ed08c028e5 sha1: MSVC is braindead, so help it out a little. 2016-06-26 17:20:25 -04:00
Tyler J. Stachecki 322ac0c934 Another fix for MSVC builds. 2016-06-26 17:20:20 -04:00
Tyler J. Stachecki 3288229a50 Start fixing MSVC builds.
Conflicts:
	rdp/n64video.c
2016-06-26 17:19:17 -04:00
Tyler J. Stachecki 8415caf9ad RDP fixes. Wonder how long these have been there? 2016-06-26 12:20:29 -04:00
Tyler J. Stachecki 51b83257f7 Remove unused cen64_context_* calls.
Originally these functions were intended to workaround
problems experienced by RSP vector register caching,
but we don't use it anymore so we can just nix them.

Fixes #41
2016-06-22 09:15:10 -04:00
Mike Ryan 406b080fd1 multithread: stop all threads from running when window is closed
Add a "running" boolean to the master device struct, and set it to false
when the main window is closed. All the tight inner while (1) loops now
become while (running).

Closes #24
2016-06-19 09:56:24 -07:00
Mike Ryan 0d087a054e cmake: remove build system dependency on GNU as 2016-06-19 08:55:53 -07:00
Tyler J. Stachecki 61afc41641 Ignore DP freeze setting.
Thanks to simer and Happy for pointing out something that
also cropped up in MAME: http://forums.bannister.org/
ubbthreads.php?ubb=showflat&Number=94626#Post94626

This hack fixes Banjo-Kazooie.
2016-06-19 10:24:42 -04:00
Mike Ryan 7068720b25 si: return PIF error when controller not present
Closes #38
2016-06-17 17:07:11 -07:00
Tyler Stachecki 9f5f3c2e75 Compile n64video.c with -fno-strict-aliasing.
Lots of violations to the strict aliasing rule throughout.
2016-06-17 05:43:41 -04:00
Tyler Stachecki 0c41dc33dc Upgrade to angrylion r98.
r97 was VI filter related and r98 just adds MSVC solution files,
so this commit is really just for posterity more than anything.
2016-06-17 05:31:19 -04:00
Tyler J. Stachecki cc07dad626 angrylion-rdp: Upgrade from r83 to r96.
Patch courtesy of Snowstorm64; thank you.

Conflicts:
	rdp/n64video.c
2016-06-17 05:11:27 -04:00
Tyler Stachecki 8ce013b165 Fix RDP RDRAM access range on Linux. 2016-06-17 05:07:25 -04:00
Tyler Stachecki 154343bdea Commit latest fork of angrylion/MAME RDP.
Conflicts:
	device/device.c
2016-06-17 05:06:34 -04:00
Mike Ryan 73f4420a4c fix all build warnings, does not affect functionality 2016-06-16 20:40:51 -07:00
Mike Ryan 1d41bb8808 membus: remove duplicated instance of si
Fixes a bug introduced in a4f0d72. read_pif_rom and read_pif_ram were
replaced with a unified read_pif_rom_and_ram, but the excess si instance
remained in the instance mapping.
2016-06-14 21:39:28 -07:00
Simon Eriksson 802556002e Added region field in cart DB.
This field is required in order to distinguish between regional
versions where the game ID is the same but the save type differ,
such as the Castlevania games.

Also added more Japanese-specific game IDs and edited some descriptions.
2016-04-03 11:12:31 -04:00
Tyler J. Stachecki bb41f7208e Implement mapped SRAM accesses. 2016-03-20 15:18:17 -04:00
Tyler Stachecki f7df75babc Merge pull request #40 from exhalatio/cart_db
Add Save list entry in the cart DB.
2016-03-19 16:03:12 -04:00
Tyler J. Stachecki d905183b11 izy removed the LUT from bitwise operations.
In addition to removal of all memory accesses from the
functions, these functions also result in fewer executed
instructions in some cases.
2016-03-16 22:59:22 -04:00
exhalatio 852f6cea24 Add Save list entry in the cart DB. 2016-03-16 12:04:32 +09:00
Simon Eriksson 8d17792969 Minor fix to description in cart DB.
Majora's Mask has the same ID in all regions.
2016-03-12 16:20:56 -05:00
Simon Eriksson 1b33cffa9c Add description field in the cart DB.
This description is printed along with the ID when a cart is detected.
Also includes a fix to a bug in the cart DB verification function.
2016-03-06 13:56:19 -05:00
Simon Eriksson 135a6cab5e Change default window size and aspect to 640*474.
Fixes vertical stretching issues when the N64 framebuffer
has 240 or 480 lines.
2016-03-06 13:56:13 -05:00
Tyler J. Stachecki 3565a05f30 rsp: Use host byte ordering for ICACHE.
Up until the, the RSP was storing instruction words in big-
endian format. Thus, each fetch on an x86 host requires a
byteswap. This is wasteful, so use host byte ordering for
the ICACHE (as the VR4300 does now).
2016-02-27 19:13:50 -05:00
Tyler J. Stachecki d163ff83a9 More audio optimizations from izy. 2016-02-27 18:24:19 -05:00
Tyler J. Stachecki 6a701096c1 Implement izy's SSE audio processing idea.
izy noticed that the audio buffers are usually >= 64 bytes
in size and aligned to 16 bytes. This makes them a very good
candidate for SSE (instead of swapping a word at a time).
2016-02-27 18:06:18 -05:00
Tyler J. Stachecki 1855797178 Update contributors and README.md. 2016-02-27 16:04:24 -05:00
Tyler J. Stachecki d2d9dd6371 simer's cart db patch.
simer suggested (and implemented) the use of ROM IDs instead
of titles: "I've also found that the header name in some cases
are too inprecise, for example "TOP GEAR RALLY" has EEPROM 4K
for the Japanese and European versions, but not for the American.
2016-02-27 15:39:26 -05:00
Tyler J. Stachecki e70455761b More optimizations from izy.
This optimization removes the LUT in LWL/LWR:

At the moment when the LUT is used inlined this code is generated:
OR LUTAddr(offset), dqm

That is something like:
OR 0x400760(,%rdi,8),dqm

The code equivalent to "mov %edi,%edi" from the function above can get removed.
I want to assume anyway that accessing the LUT and updating the "dqm" variable
generates a single instruction with memory access.

With the patch the generated code is:
add $0xfffffffd,%edi
sbb %rax,%rax
OR %rax, dqm
Thus my patch increases the amount of opcodes by two instructions.

The LUT has 3 advantages on its side:
- The function VR4300_LWL_LWR() will use the value read from the LUT only once
  and only for a logic-OR.
- On x86 a logic-OR is an operation that can work with the source operand read
  from memory
- The "offset" variable is pre-calculated and can be used "as is" by the LUT.

The code with my patch (without the LUT) has only an advantage on its side:
- The LUT (memory access) is removed
2016-02-22 00:02:26 -05:00
Tyler J. Stachecki 08f1667432 Expand the cart list.
Thanks: Snowstorm64 and krom.
2016-02-21 21:02:36 -05:00
Tyler J. Stachecki 9d9655cf62 vr4300: Sign extend results from MFC0.
This bug prevented Conker's Bad Fur Day from booting.
2016-02-17 02:00:13 -05:00
Tyler Stachecki 8dcb4b6f8f Merge pull request #37 from jkbenaim/controls-doc
Add a note about the default keyboard controls.
2016-02-08 01:32:12 -05:00
Jason 2caa344678 Add a note about the default keyboard controls. 2016-02-07 19:33:13 -05:00
Tyler J. Stachecki 88c65ae630 Another great optimization from izy.
izy managed to remove another LUT used in add/sub related
insructions. The devil is in the details (see commit).

<new>:
00000000004006b0 <rsp_addsub_mask>:
  4006b0:       c1 ef 02                shr    $0x2,%edi
  4006b3:       19 c0                   sbb    %eax,%eax
  4006b5:       c3                      retq

<old>:
00000000004006d0 <rsp_addsub_mask>:
  4006d0:       83 e7 02                and    $0x2,%edi
  4006d3:       8b 04 bd 80 07 40 00    mov    0x400780(,%rdi,4),%eax
  4006da:       c3                      retq

"You see that this patch doesn't increase the amount of
instructions. They are always two/three/four instructions
and with automatic register selection. This is always the
case with a MOV from memory... you can load to any register,
but the same will happen with a SBB over itself. That is
also the reason why when the function is inlined it won't
require any special register (such as a the EAX:EDX pair,
the "cltd" instruction you see in the 32 bit code is only
a coincidence caused by the optimizations done by the gcc
and isn't mandatory).

The System V AMD64 calling convention puts the input
parameter in rdi, but wherever the selector is placed
nothing changes. The output parameter is in rax, but
MOV/SBB can work with any register when inlined.
2016-02-07 14:01:00 -05:00
Tyler J. Stachecki 3003d774cb Improved SSE2 vector shuffle patch from izy. 2016-02-06 14:26:47 -05:00
Tyler J. Stachecki e12a459b18 More optimization patches from izy.
izy noticed that the branch LUT was generating memory moves
and could be replaced with an inlined function that coerces
gcc into generating a lea in its place:

  4005ac:       8d 1c 00                lea    (%rax,%rax,1),%ebx
  4005af:       c1 fb 1f                sar    $0x1f,%ebx
  4005b2:       f7 d3                   not    %ebx
(no memory access)

  4005b9:       c1 e8 1e                shr    $0x1e,%eax
  4005bc:       83 e0 01                and    $0x1,%eax
  4005bf:       44 8b 24 85 90 07 40    mov    0x400790(,%rax,4),%r12d
(original has memory access)

This ends up optimizing branch instructions quite nicely:

"You see that when you use "mask" you execute "~mask". The
compiler understands that ~(~(partial_mask)) = partial_mask
and removes both "NOTs". So in this case my version uses 2
instructions and no memory access/cache pollution."
2016-02-06 13:43:07 -05:00
Mike Ryan 3235ee74eb options: document controller and save options 2016-02-05 21:44:53 -05:00
Mike Ryan b2721e7d37 rtc: implement RTC
Untested in-game since Animal Forest does not yet run.
2016-02-05 21:44:48 -05:00
Mike Ryan cfd2336443 time: move get_local_time out to platform-specific dir
Patched DD code to make use of this code. Untested on Windows.
2016-02-05 21:44:42 -05:00
Tyler J. Stachecki 4e0620c637 rsp.c patch from izy. 2016-02-03 22:30:54 -05:00
Tyler J. Stachecki e0c3fdd47f Fix PI/DD bugs that broke some carts.
Readjust PI DMA delay timing slightly (until we get some
more accurate timing information or simulation to replace
it altogether).
2016-01-30 19:39:10 -05:00
Tyler J. Stachecki bdee3731ae Don't abort emulation on SHA mismatch.
SHA checksum computation is broken on Windows builds,
so don't abort out if the checksum doesn't match; just
warn.
2016-01-30 18:42:46 -05:00
Tyler J. Stachecki 4461ad9cf1 Fix 64DD RTC for Windows builds. 2016-01-30 18:10:43 -05:00
Mike Ryan 4fc80b7e8b dd: functional N64 DD implementation
Does not handle disk writes. Expect disks in MAME format.
2016-01-30 16:28:00 -05:00
Mike Ryan 71f405ea40 pi: adjust DMA delay to work with 64dd 2016-01-30 16:27:45 -05:00
Mike Ryan a0840f1e04 pi: return 0 for mapped read of non-present cart 2016-01-30 16:27:41 -05:00
Tyler J. Stachecki 3c7765b136 (More) fixes for SHA1 compilation errors on Windows. 2016-01-30 15:42:42 -05:00
Tyler J. Stachecki b7bf8be66d Forgot a keyword in an older commit. 2016-01-30 15:42:38 -05:00
Tyler J. Stachecki 36b2aabc2b Fixes for SHA1 compilation errors on Windows. 2016-01-30 15:42:35 -05:00