Commit graph

1883 commits

Author SHA1 Message Date
Gillou68310
e910081757 Remove references to invalidate_all_pages outside the new_dynarec 2017-10-21 09:22:36 +02:00
Gillou68310
eb4cab169b new_dynarec: Fix https://github.com/mupen64plus/mupen64plus-core/issues/385 2017-10-21 09:19:08 +02:00
Logan McNaughton
e415e75560 Force word alignment in SI DMA 2017-10-19 23:10:59 -06:00
Bobby Smiles
092a7c270a Minor edits to loganmc10 SI refacotrings:
- remove si_schedule function. Move it inside write_si_reg body.
- add word-alignment restriction on dram address, and do word-copy
- rename si_type to dma_dir, also SI_DMA_NONE is now SI_NO_DMA
- pif_addr validity test is more relaxed (test only 25 bits).
- add more comments
2017-10-20 01:59:34 +02:00
Bobby Smiles
d5026c76a5 Remove unused pi_status from cart_rom.
Also, now that pi_status is not used outside of pi_controller.c move
pi_status enums inside pi_controller.c
2017-10-19 23:32:26 +02:00
Logan McNaughton
1dfecd4af3 Make pi DMA lengths consistent 2017-10-19 14:38:44 -06:00
Logan McNaughton
17bab84d42 Don't use IO_BUSY flags for DMA 2017-10-19 14:27:28 -06:00
Bobby Smiles
ac2b6bab33 Fix (again) duplicate saves in Paper Mario (U)
Was not mapping correctly PI_DOM3_ADDR2 space.
2017-10-19 18:51:32 +02:00
Bobby Smiles
273ae923d8 Move cart_rom, flashram and sram into cart module. 2017-10-19 14:26:50 +02:00
Bobby Smiles
f6700de7a2 Pass cart_rom instead of pi to {read,write}_cart_rom functions. 2017-10-19 13:41:11 +02:00
Bobby Smiles
8fe2aa033f Refactor pi dma logic.
PI controller now accepts 4 different dma handler, one for each DMA'able
region (DD ROM, CART SAVE, CART ROM, 1FD00000). Each handler is
responsible for effective data transfer and some extra operation as
needed (cached_code invalidation for instance).
2017-10-19 13:41:11 +02:00
Logan McNaughton
89a1e41184 Re-work the way VI interrupts are timed 2017-10-18 18:16:38 -06:00
Bobby Smiles
e826cf0939 Fix crash when loading savestate.
savestate loading code was trying to poweron rumble pak on a
non-initialized rumble pak.
Now we check that the game is rumble pak compatible (therefore it has
been initialized) before calling the poweron function.

A similar issue was also present for transferpak.
2017-10-15 16:04:12 +02:00
Logan McNaughton
c35cae784d rand() does not work in MinGW, use rand_s 2017-10-13 20:33:50 -06:00
Logan McNaughton
51c4471d42 Randomize PI/SI interrupt timing 2017-10-13 20:33:50 -06:00
Bobby Smiles
2c4ae15d64 Rename GB cart loader to media loader. 2017-10-14 03:23:43 +02:00
Bobby Smiles
ac700c87b3 Fix controllers state loading. 2017-10-14 03:23:43 +02:00
Bobby Smiles
51aa73d935 Remove testing code. 2017-10-14 03:23:43 +02:00
Bobby Smiles
004bdda0c8 Fix returned value for M64CMD_SET_GB_CART_LOADER command. 2017-10-14 03:23:43 +02:00
Bobby Smiles
ded3624cdc Fix msvc compilation.
objects of static storage duration are guaranted to be zero initialized
anyway.
2017-10-14 03:23:43 +02:00
Bobby Smiles
6a828f2971 Disable testing code. 2017-10-14 03:23:43 +02:00
Bobby Smiles
cf75ee1fc6 Fix NULL pointer dereference when no GB cart loader is defined. 2017-10-14 03:23:43 +02:00
Bobby Smiles
1e8a490ef3 Be more tolerant about RAM file size. 2017-10-14 03:23:43 +02:00
Bobby Smiles
2a20df9c56 Document GB loader functions. Bump version.
Also during this process, I felt necessary to slightly alter functions
prototypes (better name, easier usage/implementation).
I also specified the NULL terminated strings ownership, and thus
reworked some aspects of objects ownership.
NULL or empty strings usage also have been documented. For ROM, empty or
NULL strings allow to have an empty transferpak. For RAM, empty or NULL
strings will let the core generate a suitable save filename and
initialize it with empty content. This can be helpful when a GB save
file is not available and the game doesn't really care about the initial
saved content (for instance Perfect Dark).

The init_gb_cart function as also been slightly modified to better
handle loading failures (and not leak stuff in this case).

The GB pak switch function is now only activable when the game is
compatible with the Transferpak. Still you can change what is inside the
transferpak even when the transferpak is not plugged in.
2017-10-14 03:23:43 +02:00
Bobby Smiles
d440020a3b Avoid usage of initialized static variables inside functions
because they are not reinitialized when stopping/restaring emulation.
2017-10-14 03:23:43 +02:00
Bobby Smiles
e56a9294ca Implement GB cart switching. 2017-10-14 03:23:43 +02:00
Bobby Smiles
c71a6d547b Add some constants to ease controller input backends writing. 2017-10-14 03:23:43 +02:00
Bobby Smiles
9e54900c07 One less warning in pi_controller. 2017-10-14 03:23:43 +02:00
Bobby Smiles
3b7dbabf46 Fix some warnings found by msvc. 2017-10-14 03:23:43 +02:00
Bobby Smiles
a35a724705 Add SET_GB_CART_LOADER core command. 2017-10-14 03:20:41 +02:00
Bobby Smiles
88303abb31 Use rom db to know paks compatibility.
Adds 2 new fields : Transferpak=*Yes*|No, Mempak=*Yes*|No (default value
between *).
2017-10-14 03:20:41 +02:00
Bobby Smiles
7f727759c0 Implement pak switching inside the core.
The mempak switch button is repurposed as a pak switching button.
By pressing this button, the next compatible pak is inserted into the
controller.
2017-10-14 03:20:41 +02:00
Bobby Smiles
8682a7ce8b Separate interfaces from mutable state in all backends.
Also
* Move backends implementations under backends directory.
* Rework file_storage to be a real implementation of storage_backend.
* Fixup PIF_PDT_EEPROM types
* Extract joybus stuff from pif module.
* Extract cart stuff from pif module.
* Extract controllers and paks from si module.
2017-10-14 03:20:41 +02:00
Bobby Smiles
0f02d0074c Move some controller initialization stuff around. 2017-10-14 03:12:46 +02:00
Bobby Smiles
891c7005de Remove some unneeded headers. 2017-10-14 03:12:46 +02:00
Bobby Smiles
ebc772e89c Stubbing mouse controller implementation.
As this is fairly similar to a standard controller (at the pif
protocol level), I just implemented it using a game controller "flavor"
and not a separate entity.

Still WIP and not accessible (unless you hack your way inside main.c).

Also, in the future it should be possible to implement other kind of
"simple" game controllers such as the train controller.
2017-10-14 03:12:46 +02:00
Bobby Smiles
cf2cbc9c74 Move pif channel devices outside of si module. 2017-10-14 03:12:46 +02:00
Bobby Smiles
588825aceb Get rid of detect_pak function. 2017-10-14 03:09:28 +02:00
Bobby Smiles
8f651dc0f1 Get rid of is_connected method in controller_input_backend. 2017-10-14 03:09:28 +02:00
Bobby Smiles
64bf0128a1 Remove some leftovers in new_dynarec. 2017-10-14 01:01:14 +02:00
Bobby Smiles
c7b3695b2b Fix memory breakpoints logic.
I broke it when introducing opaque data to read/write memory handlers.
The issue was that there is a single opaque pointer for both read and
write function, whereas read and write breakpoints can be activated
independently. This was leading to a situation where wrong opaque
pointers was passed to read/write handlers.
2017-10-14 01:01:14 +02:00
Bobby Smiles
1c01c2339b Rewrite pifbootrom to avoid usage of device struct. 2017-10-14 01:01:14 +02:00
Bobby Smiles
0e05ecb3f3 r4300_core header is only needed when debugger is enabled. 2017-10-14 01:01:14 +02:00
Bobby Smiles
2af4695240 Introduce mem_{read,write}32 functions. 2017-10-14 01:01:14 +02:00
Bobby Smiles
65182eafe3 Store dbg_handler in memory struct to avoid direct coupling with g_dev. 2017-10-14 01:01:14 +02:00
Bobby Smiles
9f79c57fb8 Pass r4300 pointer to fast_mem_access. Move it inside r4300 module. 2017-10-14 01:01:14 +02:00
Bobby Smiles
a923123a68 Introduce some memory mappings constants. 2017-10-14 01:01:12 +02:00
Bobby Smiles
143cfa7139 Introduce memory base.
The allocated memory is big enough (512M) to hold all the directly
accessible physical memory an N64 system have.
By having a single allocated block of memory we don't have to if/switch
for accessing ram, sp_mem, pif_ram and cart_rom in fast_mem_access.

This is also a first step toward implementation of "fast memory".
2017-10-14 00:58:54 +02:00
Bobby Smiles
07ff5622e1 Move memory map definition in device module. 2017-10-14 00:26:31 +02:00
Bobby Smiles
81e47ebaed Rework r4300 dword access functions. 2017-10-14 00:26:23 +02:00