Commit graph

2672 commits

Author SHA1 Message Date
casualjames casualjames
be91c75c8e Set the PJ64 savestate TLB EntryDefined to 1 only if the entry has one of the valid bits set, 0 otherwise. In addition, I confirm that the TLB writing code should be correct since last commit which changed it. The previous code did leave some bits undefined. 2012-08-17 19:14:01 +02:00
casualjames casualjames
15dbffe8f5 Merge the status register handling code back to their original functions, now that we don't need to set the byte flags. 2012-08-17 04:59:02 +02:00
casualjames casualjames
28742feb75 Use AND+negation to unset bits 2012-08-17 04:35:22 +02:00
casualjames casualjames
40d68a384f Remove flashRAM load/save from buffer functions, which are unused following the savestates changes. The old setup was pointless anyway, since it hid the global variables, but provided a backdoor to read and write them anyway. 2012-08-17 03:11:39 +02:00
casualjames casualjames
4ba11f9e18 SEE THIS BEFORE PREVIOUS COMMIT. Remove the rest of the memory flags, and correct a bug which last commit uncovered.
Before last commit, SP_INT ORed sp_status_reg with 0x303 (signal1, signal2, halt, broke), but only set the byte flags for signal2, broke, halt (the line for signal1 was commented). This caused a desync between the status reg and the byteflags. Next time update_SP was called, the register was rebuilt using the flags, so signal1 was unset from the status reg.
This commit does not set the signal1 bit in the sp status reg (which is consistent with the taskdone() function on the HLE RSP and the most likely previous behaviour), but this may change behaviour (for the better).
2012-08-17 02:04:06 +02:00
casualjames casualjames
11a61dda3f Remove byte flags from SP_register. More to follow. 2012-08-17 00:19:41 +02:00
casualjames casualjames
7035d4b15d Finished the new savestate model.
By the way, last commit also changed the way Project64 TLB entries were written, not sure why. I believe they are written correctly now since I'm writting the same register values that are set in the TLBWI/TLBWR instruction. Anyway, I don't think TLB was working anyway since EntryDefined was never set (now it's always set, so it may still not work). This needs more testing agains PJ64.
The big file size increase should stop now, and maybe some cleanup will make up for it.
2012-08-16 22:27:48 +02:00
casualjames casualjames
3ca17b143c Bring the new savestates improvements to PJ64 savestate saving.
In addition, this fixes two other bugs to the PJ64 saving code: A out-of-bounds error when writting zeroes to the FCR1..31 field, and a uninitialized value error when writting the EntryDefined field of the TLB.
2012-08-16 03:47:09 +02:00
casualjames casualjames
75fa1948fc Initial attempt to make the savestate code endian-independent, compiler-independent and detach it from the emulator's internal representation.
So far only the code to read savestates has been modified. There's no error checking yet, but should be easy to add. A test to load a savestate from another endianness has been successful.
There has been a noticeable file size increment, but there's hardly any way to avoid it. I expect to be able to remove some code from other parts of the emulator once this task has been completed and structures can be modified freely.
2012-08-16 02:32:04 +02:00
casualjames casualjames
126d6e1d11 Experiment: Group all plugin functions in structures, to make it clear through the code where we're using plugins (they look like normal function calls to the untrained eye). 2012-08-15 04:27:42 +02:00
casualjames casualjames
3a538efff5 Tab fix. 2012-08-15 02:43:40 +02:00
casualjames casualjames
536282a526 Fix the ROM database. Fixes Excitebike 64 and maybe others. 2012-08-15 02:42:19 +02:00
casualjames casualjames
77c9ea932a Allow forward RefMD5 references. 2012-08-15 02:36:42 +02:00
casualjames casualjames
9db46fa4e7 Add lots of error checking to the ROM database code. 2012-08-15 02:25:25 +02:00
casualjames casualjames
8d74a599d6 Plugin.c: Readd l_GfxAttached=1 line which was somehow removed during the refactorings. 2012-08-10 17:54:52 +02:00
casualjames casualjames
d0a59fbe58 Pull latest core changes. 2012-08-09 21:30:59 +02:00
casualjames casualjames
1937ecaf9e Use savestates_clear_job instead of savestates_set_job to release memory. 2012-08-09 21:28:12 +02:00
casualjames casualjames
04d9e4fb1c Don't display the volume on the OSD on frontend volume_get_level. Specify signedness of char because the comparison to 0x8b would be false on systems where char is signed. 2012-08-07 22:19:56 +02:00
casualjames casualjames
673cbfd006 Add missing return to main_reset 2012-08-06 22:05:06 +02:00
casualjames casualjames
eeb552cf6e Polish frontend API and docs 2012-08-06 22:03:49 +02:00
casualjames casualjames
abd2c8f74d Small fixes for savestates. 2012-08-06 22:03:46 +02:00
casualjames casualjames
d4eb3e1649 Don't use global fname at savestates_detect_type. 2012-08-06 22:03:44 +02:00
casualjames casualjames
5fa33a93ef Remove unused functions. 2012-08-06 22:03:42 +02:00
casualjames casualjames
2929e126da Call the new main_* functions instead of calling the plugins directly. 2012-08-06 22:03:39 +02:00
casualjames casualjames
84b3bef9db Redesign the savestates internal API to be simpler and more extensible. Detect the savestate type when loading instead of doing trial-and-error. Add support for loading and saving Project64 uncompressed saves (those can be generated by PJ64 by unchecking a box in the advanced settings). Also, fix the PJ64 state saving code, which got broken in the commit which was supposed to add error checking. And finally, on error conditions, print the full savestate path, to make things easier for the user. Still lacks checks, endianness handling and some simplicity. 2012-08-06 22:03:35 +02:00
casualjames casualjames
e205d858ca Lots of fixes for PJ64 state loading. This should fix most crashes. Changes: Add a COMPARE_INT to the queue, this is what fixes most crashes; don't call some update_* functions which have side effects; call some other needed update_* functions; reordered some things. There's a bit of a mess on memory.c now tough. Also, there remain some audio bugs (noise or muted audio), but don't seem to cause any problem outside that. 2012-08-06 22:03:31 +02:00
casualjames casualjames
9d897f887d Add profiling support for Windows. 2012-08-06 22:03:28 +02:00
casualjames casualjames
f7eae9c359 Replace stray tabs with spaces. Always set recomp_func after dst->ops 2012-08-06 22:03:26 +02:00
casualjames casualjames
af7c79fb1f Remove unused 'source' parameter from init_block. Reoganize NOTCOMPILED. 2012-08-06 22:03:24 +02:00
casualjames casualjames
649823eb99 Don't use magic numbers on the profiling code. Indent profile.c consistently. 2012-08-06 22:03:22 +02:00
casualjames casualjames
2fdb149da9 Add a Makefile switch to enable section timing. Use clock_gettime instead of gettimeofday (which returns wall time). Also remove the useless fflush call which broke compilation. 2012-08-06 22:03:15 +02:00
casualjames casualjames
a6757df660 BUGFIX: RSUB and RNOR shouldn't be compiled on the dynarec if writing to R0; Make free_exec compatible with malloc_exec; OPTIMIZATION: Do not set dst->ops to J_OUT or JAL_OUT if not needed; REFACTOR: Instead of running the dynarec function directly, save it in a variable, then run it if needed. This saves the hack in is_jump, but introduces other duplicated code (I will reverse this commit if it has an effect on performance). 2012-08-06 22:03:13 +02:00
casualjames casualjames
ec2a2eedee Change ini_parse_line behaviour on comments, not to return the comment starter (config.c expects it that way). Use reset_soft in eventloop.c instead of adding the interrupts directly. 2012-08-06 22:03:11 +02:00
casualjames casualjames
7a776d9830 Unbreak osal_mkdirp from last commit and document its behaviour. 2012-08-06 22:03:08 +02:00
casualjames casualjames
7e3da35b05 Compilation fix on savestates.c. Other compilation fixes for Visual Studio. Minor fixes. 2012-08-06 22:03:01 +02:00
casualjames casualjames
d8e7bec734 Error error checking to Project64 state saves (More error checks to follow). Map the so called SP_PC_REG and SP_IBIST_REG to rsp_register.rsp_pc and rsp_register.rsp_ibist (not 100% sure, must test). 2012-08-06 22:02:26 +02:00
casualjames casualjames
112c40c880 Do not make ROM_HEADER point to the ROM, because it may be byteswapped by init_memory. Instead, copy the ROM header. Also, use sl() on Manufacturer_ID, due to the structure of m64p_rom_header 2012-08-06 22:02:16 +02:00
casualjames casualjames
2440a790f9 Remove useless extern declarations. 2012-08-06 22:02:13 +02:00
casualjames casualjames
6eee1673dc Move the TLB lookup table creation code to memory/tlb.c 2012-08-06 22:02:11 +02:00
casualjames casualjames
710d278ef2 Remove duplicate code in the TLBWI and TLBWR instructions (for all r4300 emulators). Use the faster loop version found in the non-pure-interpreter TLBWR implementation in all implementations. Note that this changes the lowest 12 bits in the TLB lookup tables from 0xFFE to 0xFFF, but this shouldn't matter because it is always taken AND 0xFFFFF000 by the emulator. 2012-08-06 22:02:09 +02:00
casualjames casualjames
932144f4aa Remove unnecessary temporal variables from parse_md5. 2012-08-06 22:02:07 +02:00
casualjames casualjames
c27f12451a Remove local ROM_HEADER which made the global be NULL. Join the INI parsers on config.c and rom.c, which clarifies romdatabase_open a bit. Also, remove g_romdatabase.comment, since it only signaled the database creation and required several dynamic allocations. Fix two undefined behaviour bugs on romdatabase_open: One call to snprintf with overlapping buffers (while generating g_romdatabase.comment), and a malloc call whose size is potentially zero, which potentally returned NULL and crashed the program (on GoodName handling). 2012-08-06 22:02:05 +02:00
casualjames casualjames
9ad0ff3e7f Use NULL instead of empty_entry (which is not used anywhere). 2012-08-06 22:02:03 +02:00
casualjames casualjames
ee559d8854 Simplify hexconvert. 2012-08-06 22:02:01 +02:00
casualjames casualjames
15175668d1 Add a new ROM_PARAMS.aidacrate field, and simplify write_ai* functions. This also adds partial support for the MPAL system type (which has no corresponding country code yet). 2012-08-06 22:01:59 +02:00
casualjames casualjames
2a380c417b Move internal parameters from (public) m64p_rom_settings to (private) rom_params. Also, keep ROM_HEADER around (as m64p_rom_header), mostly for future use. 2012-08-06 22:01:57 +02:00
casualjames casualjames
340a6c4b98 Fix M64CMD_ROM_GET_HEADER if the frontend doesn't request the full header (broken in last commit). 2012-08-06 22:01:54 +02:00
casualjames casualjames
cab17857a4 Remove the ROM_HEADER field and the rom_header structure. The clean ROM name is now stored on ROM_SETTINGS.headername (which is properly NUL-terminated). Rationale is that struct rom_header is a duplicate of struct m64p_rom_header, and ROM_HEADER was only used to get the ROM name (and the country code in the goldeneye hack). If you want to access the ROM header fields, you can just cast rom to m64p_rom_header*. 2012-08-06 22:01:52 +02:00
casualjames casualjames
de8a79de90 Refactor osal_mkdirp, adding proper error handing and a quick exit path. Windows version is untested yet, will be fixed in a later commit if it's broken. 2012-08-06 22:01:49 +02:00
casualjames casualjames
3616ee67e7 Small fixes and refactorings, including a fix to a free'd memory read in delete_section introduced in one of my commits. 2012-08-06 22:01:47 +02:00