Commit Graph

94 Commits

Author SHA1 Message Date
Akash a9b63a2106 PCSX2-GS: Use interrupt mask register bitfields
Previously, the code used a lot of "bitwise AND" to get specific bitfields of the interrupt mask control register, which makes the code look a bit hacky, also it's even more hard for normal people to calculate the value when hexadecimal values are used for the bitwise operations where the register is totally binary. Instead of dealing with all those mess, let's just get the bitfield values from the already implemented nice union of the IMR register. FWIW it also makes the code more readable.
2016-12-01 16:32:27 +05:30
Gregory Hainaut 4796803c33 pcsx2: Remove == true/false for boolean logic (#1556)
As discussed in #1553

Clang Tidy reports goes from 156 to 9.

Remain some macro in spu2x + a deadcode line
2016-09-10 20:08:14 +02:00
Akash 7e5bca3dfd Counters: Make the code behavior more explicit
CID 168623 (#1 of 1): Missing break in switch
(MISSING_BREAK)unterminated_case: The case for value
GS_VideoMode::Unknown is not terminated by a 'break' statement.
2016-09-03 20:29:40 +05:30
Akash 95d70db153 Counters: Move interlace detection code to SetGsCrt
* More accurate to PS2 behavior and avoids an useless SMODE write function, it makes sense to also move this as video mode specific colorburst detection was already moved to SetGsCrt.
2016-08-20 23:32:20 +05:30
Akash e7f66900fa Counters: Add a new function GetVerticalFrequency()
No functional changes done, the current commit helps us to pass vertical frequency values of individual video modes to GUI code for accurate percentage calculation on titlebar. (which is done on the succeeding commit)
2016-08-05 18:23:55 +05:30
Akash 78bf5ad88e PCSX2-Counters: Move VideoMode init code from _gsSMODEwrite to SYSCALL
* Moving the code to SYSCALL enables us to detect all the video modes properly.
* Added proper detection of VESA,HDTV,BIOS video modes.
2016-07-09 21:50:38 +05:30
Akash e7d4bc4506 PCSX2-Counters: Remove default video mode variable
* Fixes a bug where NTSC VideoMode was automatically used when videomode is uninitialized. the bug was only temporary till the SMODE register was written.
2016-07-09 21:50:37 +05:30
Akash a1fdf1e625 PCSX2-Counters: Rename "GS_RegionMode" to "GS_VideoMode"
Technically there's no term called "RegionMode" and the values obtained through the SMODE1 register is actually used for identifying the video mode of the game not any region modes.

* Convert "GS_VideoMode" into an enum class
2016-07-09 21:50:28 +05:30
ramapcsx2 ec07571069 Revert "PCSX2-Counters: Some Changes to Video mode counter stuffs" 2016-06-09 00:44:14 +02:00
Akash 1a41053c76 PCSX2-Counters: Improved video mode detection
* The detected values using the SMODE registers were for the video modes and not the region of the game, changed the variable naming to video modes to prevent any confusions.
* Fix a bug where 1080I was reported as progressive
* Convert GS_VideMode into an enum class
* Move VideoMode init code from _gsSMODEwrite to SYSCALL
* PCSX2 will now correctly report whether the video mode is NTSC/PAL/VESA/480p/576p/720p/1080i/1080p
2016-06-04 22:10:27 +05:30
ramapcsx2 c8a7a709dc bring vsyncinfocalc up to the revision that seems to fix 2 games that
got broken by the last update. debugger output still looks sensible.
2015-12-13 19:20:58 +01:00
ramapcsx2 601d18272b Small fix to the timing revert: need to use gsRegionMode now since scansPerFrame isn't fixed anymore.
(NTSC modes would fail to update the vblank variable)
2015-12-05 02:07:27 +01:00
ramapcsx2 ff2845b2d2 When debugging vSyncInfoCalc(), some serious problems with the math resulted in a nearly saturated u64 and hRender being 0 in all video modes. Team decided to revert to the earlier version, even though it probably breaks "Legendz Gekitou! Saga Battle".
No one knows how any games even started in the broken state and we prefer code being sane('ish) over one game miraculously working. The change is pretty big so it needs some good testing!
2015-12-05 00:25:16 +01:00
refractionpcsx2 d01f8f9252 VSync/EE Counters: Fixes for Fatal Fury BA 1 & Legendz Gekitou! Saga Battle
-Fix up Vsync again, broken back in google code days, broke Fatal Fury, matches PS2 test again.
-Corrected the Vsync Gate 0, which was the wrong way around, Causing Legendz Gekitou not to work unless Vsync was wrong
2015-10-16 00:38:04 +01:00
Avi Halachmi (:avih) ddb87027f9 folderMemoryCard: hack - don't call hundreds of times per second
In order to flush data with some delay after save-to-memory-card, the code was
calling sioNextFrame() on each frames (60 times/s) continuously as long as the
emulation is active, regardless if FMC is in use or if memory cards in general
are in use.

Further to that, each call to sioNextFrame calls 8 times into the memory card
plugin even if FMC is not in use, resulting in overall ~500 calls/sec with the
sole goal of facilitating delayed flush after MCD save with folder memory cards.

This patch is a hack to call it once per second instead of 60 per second, but we
need to remove this call completely.

The delayed flush will now happen after 60-120 frames instead of exactly 60.
2015-09-19 13:41:24 +03:00
Avi Halachmi (:avih) a6737b87fd Custom frame rate: improve message, respect also for NTSC-progressive
When a custom PAL/NTSC frame rate is used, PCSX2 respects it for PAL and NTSC,
but disrespected it for NTSC-progressive mode (used hardcoded 30/60). Fixed.

Also, when a custom rate was used, the console message displayed half the rate
which was configured. Now print the actual rate.
2015-09-17 01:40:05 +03:00
Gregory Hainaut 52e12baca2 pcsx2: fix gcc warning: may be used uninitialized 2015-08-13 08:48:05 +02:00
Admiral H. Curtiss f15c07653c MemoryCard: Add support for folder memcards in GUI and make both implementation function side-by-side. 2015-07-12 14:37:49 +02:00
Admiral H. Curtiss 1d46800888 MemoryCard: Full initial implementation of the FolderMemoryCard.
FileMemoryCard: Log reads and writes so I know what kind of commands I have to deal with.

FolderMemoryCard: Create basic class/method outline based on FileMemoryCard.

FolderMemoryCard: Add a FolderMemoryCardAggregator so I don't have to write every method in a way that has to handle more than one memory ca

Also shuffle around the location of code because C++ cares about stuff
needing to be defined before they're usable.

FolderMemoryCard: Implement Open().

FolderMemoryCard: Implement GetSizeInfo().

FolderMemoryCard: Implement some basic structure of Read()

FolderMemoryCard: Implement parts of Read() and Save().

Shouldn't it be Write() or Load()? Anyway, this doesn't work yet, but it
gets part of the formatting procedure done which is at least something!

FolderMemoryCard: Add method to calculate ECC.

FolderMemoryCard: Start implementing the FAT.

MemoryCard: More logging.

FolderMemoryCard: Formatting works now!

Formatted memory card isn't actually recognized as formatted yet because I don't store folder metadata yet, but we're getting there!

FolderMemoryCard: Recognize when it's trying to access a data cluster.

FolderMemoryCard: Add directory/file entry support.

On further inspection this might not a be a good way to handle erasing.

FolderMemoryCard: Method to get a file entry and file path from a file's data cluster.

FolderMemoryCard: wxDirName is garbage, let's just use wxFileName for the folder too...

FolderMemoryCard: Fix Erase method.

FolderMemoryCard: Start implementing file writes.

This is still quite broken but we're getting somewhere here!

FolderMemoryCard: Load the data from the host file system into the memory card on emulation start.

Also store superblock to host file system on end.

FolderMemoryCard: Fix a few warnings.

FolderMemoryCard: Implement file reads.

FolderMemoryCard: Proper ECC reads.

FolderMemoryCard: Reads to unmapped locations should return all 0xFF.

FolderMemoryCard: Some sort of working WriteToFile.

(Note: Doesn't always work depending on what order data gets written...)

FolderMemoryCard: Forgot a 'b' for reading files in binary mode. Whoops.

FolderMemoryCard: Load timestamps from the host filesystem.

FolderMemoryCard: r+b needs the file to exist so create if it doesn't.

FolderMemoryCard: Failsafe to allow non-sequential writes.

FolderMemoryCard: Use a cache for writes. Does not flush to host FS yet!

FolderMemoryCard: Flush the data written to the cache to the host file system on exit.

FolderMemoryCard: Since we have a cache now, remove code related to formatting, it's no longer needed.

FolderMemoryCard: More binary file mode mistakes...

FolderMemoryCard: Make it actually possible to disable/eject cards.

FileMemoryCard: Revert changes made for logging data.

FolderMemoryCard: Remove excessive logging.

MemoryCard: Note that the superblock struct is no longer unused.

FolderMemoryCard: A disabled card shouldn't try writing data on exit.

FolderMemoryCard: Log when flushing data.

FolderMemoryCard: Replace plain constants with const variables.

Should make it easier in the future to change the memory card size, if
needed.

FolderMemoryCard: Sort of handle the case when the total size of files in the memory card folder exceed the size of the card.

Not elegant but prevents ugly errors. The file that caused the card to
"overflow" will be seen as corrupted data by the PS2 browser.

FolderMemoryCard: Some sanity checks.

FolderMemoryCard: superBlock member really should have that m_ too to be consistent.

MemoryCard: Switch back to FileMemoryCard for merging.

FolderMemoryCard: Implement GetCRC() via a timestamp of the last memory card write.

Reasoning:
Regarding auto-ejecting on save load, I see that the current
implementation checks that by comparing memory card CRC and reinserting
if it mismatches. Since it's actually just about seeing if the memory
card state of the savestate and the current state match, my GetCRC() now
returns a millisecond timestamp of the last time the card was written
to. This should work out to the intended result, though I had to use
wxGetLocalTimeMillis() instead of wxGetUTCTimeMillis() since the latter
isn't available for some reason.

Fix GCC warnings and error.

MemoryCard: Switch implementations via a #define.

FolderMemoryCard: Add a NextFrame() method that should be called once per frame. Flushes written data to the host file system after a certain amout of frames have passed without any writes (currently 60).

MemoryCard: Add the NextFrame() method to the plugin API.

Counters: If the FolderMemoryCard is selected, inform it every frame in VSyncEnd() that a frame has passed.

VSyncEnd: Probably better to inform the memory card before the frame limiting.

Fix error when using wxWidgets >= 3.0.

FolderMemoryCard: Extract into its own .h/.cpp files.

FolderMemoryCard: Change cache to a map to reduce memory usage.

FolderMemoryCard: More gracefully handle lack of space when adding files.
2015-07-12 14:37:49 +02:00
Sacha 7568f6f2ec Remove deprecated jASSUME from pcsx2 core. It is still used in some plugins 2014-08-15 14:32:56 +10:00
refraction 038d3bea87 If you're gonna do a revert, you might as well do it properly :P If you don't want it doing properly, give it to me.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5904 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-16 16:21:08 +00:00
refraction f3399ead26 Vsync: Put it back to half slices, there seems to be games which don't like the vsync timing more accurate either way. Until i can work out why we will go back to the old half n half timing which all known games seem happy with.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5903 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-16 16:07:14 +00:00
refraction c979181bd7 Counters/Vsync: Adjusted VSync according to an older test we had. Fixes Legendz Gekitou! Saga Battle. Also adjusted the number of scanlines depending on if the game is using interlacing or not.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5900 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-13 22:16:21 +00:00
ramapcsx2 2cb99f0e05 Preliminary NTSC progressive scan support.
The detection is based on a quickly reversed smode1 flag and needs to be done properly.
The timing itself also needs reversing and has only been tested on the VP2 intro video.
(That video now runs without audio / video desync when progressive scan is enabled :) )

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5179 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-04-26 17:07:36 +00:00
refraction 8b563888f8 Fix for Issue 1145 - Issue introduced with VSync changed broke Dynasty Warrior games, this should resolve it. Id swapped the VSync order around but still swapped which Field first, so it started out of sync, silly me!
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5145 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-04-06 14:00:12 +00:00
refraction d9d909849d Adjusted VSync to work more like the PS2 does it, also involves a small change which "might" sold some half screen issues. Fixed a couple of counter log bugs too (caused it to crash when EE Counter logs were enabled)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4624 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-05-05 22:22:45 +00:00
ramapcsx2 3f6244894c Various console log changes. Made it a bit more colorful, too :)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4470 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-22 01:38:13 +00:00
Jake.Stine 02d5ed7f45 * Implemented GIF PATH/TAG logging option.
* Some other EE/Core logging additions and formatting tweaks.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3870 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-10-04 17:22:54 +00:00
Jake.Stine 3cfd0c68af * Rename cpuBranch[...] functions and vars to cpuEvent[...], which should be more clear and consistent as to their true purpose. (to clarify: events typically run during cpu branch instructions, but most branches don't actually have anything to do with whether or not there are events pending or events being run).
* Add some missing & ~0x0f address alignment stuff to odd-size FIFO reads/writes (thanks gregory)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3730 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-09-05 15:38:14 +00:00
Jake.Stine 003da7d287 MAJOR: All new hwRead and hwWrite handlers (expect regressions). Details:
* Writes via 16 and 8 bit ops now use 32-bit read/modify/write operations by default; which should enable nearly complete support for all such operations (instead of the formerly spotty coverage before).
 * Eliminated almost all former 8/16-bit specific register operations.  All code shares the same 32 bit handlers now.
 * Completely revamped the developer trace logs for hardware registers!  *ALL* registers are logged now, complete with address, name, and value being read/written (and nicely formatted!).
 * Handlers are now fully page-based using templated functions (minor speedup)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3704 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-08-31 05:22:26 +00:00
Jake.Stine 8375b0a989 Refactoring:
* Added __fi and __ri, which are abbreviations for __forceinline and __releaseinline.
 * Added some static qualifiers to functions in mVU, MMI ops, and others where appropriate.
 * Removed some unnecessary __fastcall qualifiers (since GCC gets funny sometimes when you combine __fastcall and inlining).
 * Made _1mb, _16mb, _1gb values common to all emulation code (moved from newVif/mvu to Common.h) -- they're useful! :)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3624 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-08-09 04:10:38 +00:00
Jake.Stine 4f9a5c6876 Remove all MMX and XMM register freeze code.
DevNote: I could have left the code for the freezes in, except I *really* don't want us to ever have to resort to using such a system ever again in the future.  For anything. (its just not safe on modern optimizing compilers)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3392 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-07-05 01:12:38 +00:00
Jake.Stine 87c80d6e2b * Add gRegionMode to the savestates; probably fixing a lot of unstable savestate behavior on PAL games (not sure how it managed to escape -- I explicitly remember adding the region info to the savestate in pcsx2-pg like 2 yrs ago).
* Make the new MTGS register packet during vsync not upload 0xf0->0x100.  This is technically GS internal register space that the GS plugin may update or modify as it processes GIFtags.  Thus, PCSX2 shouldn't touch it.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3331 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-06-28 03:09:51 +00:00
Jake.Stine c10e47739e git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3308 96395faa-99c1-11dd-bbfe-3dabce05a288 2010-06-26 07:26:43 +00:00
Jake.Stine 35b05e3836 * Fixing automatic patch application (again!) -- random crashes could occur on some games due to in-execution recompiler resets when gamefix options were changed by the GameDB.
* Implemented --gamefixes to the command line.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3289 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-06-24 16:04:27 +00:00
Jake.Stine 70d47bf240 Copyright 2010 : PCSX2 and plugins! (notable exception: didn't update copyright info in any Gabest plugins)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2937 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-03 14:08:02 +00:00
Jake.Stine 5d37925617 Major UI renovations!
* Added versioning info to savestates! (along with some other bugfixes)
 * Simplified the Boot and System menus -- removed the old Skip BIOS hack and replaced it with the new BOOT2 injection method (which is considered hack-free at this time).
 * Removed lots of UI deadlock gotchas.
 * Some new confirmation dialogs and better error handling.
 * Implemented an exclusive SysExecutor thread, which serves the purpose of executing system/VM commands and events in uninterrupted order (including suspend, resume, savestates, etc.)



 * ... and probably broke linux!

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2911 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-04-27 13:12:03 +00:00
sudonim1 4457fe40fc Removed all trailing whitespace in *.c *.cpp *.h because it irritates me.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2897 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-04-25 00:31:27 +00:00
Jake.Stine 7cd07da2d7 Added some info to the GS window title (finally!). Includes an fps readout!
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2425 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-01-11 08:02:17 +00:00
Jake.Stine f60ed711cc Skip Bios hack works in EE interpreters now.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2343 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-14 14:36:13 +00:00
Jake.Stine c17455c702 User Interface code cleanups and bugfixes. some highlights:
* Configuration panels are all modal-less now, so that you can open the config panel and leave it open while running games.
 * Handful of thread sync improvements.
 * Fixed on-the-fly interpreter/recompiler configuration.
 * Fixed plugin hotswapping (mostly works, but still a little funny at times)
 * All new assertion dialogs and popup message handlers.
 * RecentIsoList defaults to 12 instead of 6

Dev Notes:
 * I had to create a new set of assertion functions called pxAssume*.  Originally I hoped to avoid that complexity, and just use a single one-assert-fits-all case, but turned out blanketly using __assume() for all assertion cases wasn't reliable.
 * wxGuiTools: Replaced the operator, with operator& -- the latter has proper order of precedence, the former required () to scope correctly. >_<

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2339 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-14 12:18:55 +00:00
Jake.Stine f52faead0c Re-did the VUmicro's "Cpu Provider" structs into classes, and split sVU and mVU into independent classes.
* Better error handling for when sVU fails allocating memory at a specific location (should fail less).
 * Partial support for detecting and handling non-SSE2 machines with some grace.
 * Improved sVU's allocation chances with a second try at another randomish address (and removed alloc fail spam from the console -- only logs on complete fail now).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2321 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-07 14:00:39 +00:00
Jake.Stine acbe1ed547 Cleanup for VsyncInThread, lots of source code comments. (it's fun reading! ...maybe)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2318 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-06 15:31:11 +00:00
Jake.Stine 1e431fb69a wtf? A working framelimiter? Turbo and slowmo hotkeys? Frameskipping?! Why it's all here! Rejoice! And then find lots of bugs, too, I'm sure. Note: Frameskipping has no gui stuff yet... I'll do that soon.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2294 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-03 15:51:39 +00:00
arcum42 ba37f31849 Trim and tweak a bunch of includes, and a few headers.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2197 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-14 12:02:56 +00:00
arcum42 0d68166b65 A few more changes to the patch code.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2137 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-06 04:45:21 +00:00
arcum42 6a7c617a65 Misc changes to Patches.cpp. Unconst xSHUF for the moment, so Linux compiles.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2136 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-06 01:50:11 +00:00
arcum42 839ac9017b Enable patches, and fix Linux compilation.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2125 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-03 21:29:45 +00:00
arcum42 35aac70cd1 Cause the gui to remember if 'Enable Patches' is checked. (Still not used, though.)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2121 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-03 13:31:45 +00:00
Jake.Stine 7d458d583c Revamped some console log stuff.
* Added more colors!
 * VM's EE/IOP logs (the ones that come from the emulated games themselves) are colored accordingly: EE are faint cyan, IOP are faint yellow.  They're intentionally "hard to read" because 99% of the time they're meaningless trivia (but still cool since it's what the actual devs would have used for developing the games!).

Dev Notes:
 * Removed Console.Status (specify blue/green colors manually if you want them).
 * Renamed Console.Notice to Console.Warning.
 * I changed the overloads so that both char* and wxChar* versions work like printf now (no need to use wxsFormat when working with unicode strings).  I also removed wxString& versions of the overloads.  This should (I hope) also be an easier port to wx2.9 or 3.0, when that time comes.
 * Default log color is now black instead of gray; typically you'll want to manually specify Color_Gray when doing high volume logging (like the EErec's block tracking in debug builds).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2091 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-29 13:32:40 +00:00