Console.Error() can trigger some exceptions (like out of memory)
v2:
Add a default fallback catch(...) in case someone badly add a new
exception in the codebase
Coverity:
CID 147021 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)i
2. uninit_member: Non-static class member m_handled is not initialized in this constructor nor in any functions that it calls.
This could have caused issues where e.g. Fixed100(59.94) differed from
Fixed100::fromString("59.94") due to precision compilation flags
(the former could, and did on Devel builds, end up with Raw == 5993, which
differs from the value constructed from the string at the ini file,
and then it would be incorrectly identified as a custom rate).
Rounding seems the more likely intention when effectively decreasing the
precision of a value.
Unlikely that we have code which depends on truncating behavior, though not
impossible.
Out-of-bounds memory is no longer accessed if the realloc size is larger.
If reallocation fails, the old memory will not be freed and a memcpy
will not take place.
This should match the Windows _aligned_realloc behaviour, except that an
extra parameter is used.
All refer to memcpy, and only memcpy_fast is used, so there's no point
keeping them.
Also remove the _memset16_unaligned function prototype since there's no
function definition for it.
- zerospu2: include stdint.h in Windows. (VC2012+)
- CDVDolio: Remove hash_map (not used, VC2015+)
- zerogs: Fix extern and link to utilities. (VC2012+)
- zzogl: Port windows part to wx30. (VC2012+)
Essentially, I'm telling the memory card to re-index itself with a
filter based on the game's disc serial every time a new executable boots
in the emulator.
This currently works for a lot of games, but fails in edge cases where
the game disc's serial does not match the game serial that is written to
the memory card as part of the save file's directory name. This affects
mostly (only?) games that have multiple discs. We could circumvent this
by adding a "save game serial" or something into the GameDatabase which
tells us what we should filter by for those cases.
Apart from this edge case, this appears to work surprisingly well. Try
it and see if you can find other issues!
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.
The dialog event handling is a bit messed up. An ok/cancel event sends a
close event, which sends a cancel event and repeats. This would actually
be an infinite loop if wxWidgets didn't detect a loop.
Rework the event handling to avoid the loop and to remember the
positions of modal dialogs as well.
wxWidgets 3.0 and w32pthreads both define mode_t on Windows, causing a
redefinition error. The w32pthreads mode_t doesn't get used, so I've
chosen the wxWidgets definition.
Also add <algorithm> (required by min and max) which is no longer
implicitly included on Windows, and wx/crt.h, required by wxVsnprintf in
wxWidgets 3.0
Gregory: Get all changes but keep C11 code path which will be the future
(if someone can find info on Visual Studio support)
* Keep the old posix api to use address sanitizer on gcc 4.9
Conflicts:
common/build/Utilities/utilities.vcxproj.filters
common/build/Utilities/utilities_vs2012.vcxproj.filters
common/build/Utilities/utilities_vs2013.vcxproj.filters
common/include/Utilities/MemcpyFast.h
common/include/Utilities/StringHelpers.h
common/src/Utilities/AlignedMalloc.cpp
common/src/Utilities/vssprintf.cpp
plugins/GSdx/stdafx.cpp
there was already code for this, but it was broken due to:
- the message is WM_SYSCOMMAND and wParam is SC_SCREENSAVE etc.
- GSPanel doesn't get WM_SYSCOMMAND - GSFrame does.
- also disabled screen saver while paused if not set to hide the GS window.
- it's an ugly hack where windows keeps trying to activate the screen saver
every few seconds but such code prevents it (Lilypad has the same hack).
the new code uses windows API which was designed for this.
the screen saver is now disabled while the window is focused and the emulation
is running. it's on by defauly and without GUI - the same as with normal games.
this patch addresses Windows only, but adds a placeholder for future
implementations for other platforms.
Performance is not important here. I'm not sure Windows could handle VLA
* new/delete can still be used otherwise.
* Put an assert(0) because debugger surely don't use string bigger than
128 bytes.
code is much more compact 20 lines vs 700 lines ...
builds an Utilies_NO_TLS.a archive of the common Utilities code. It replaces native TLS by a slower reimplementation
Rational: number of TLS slot is very limited by the GLIBc on linux. I hope it doesn't impact performance.
* Zzogl don't requires TLS AFAIK
* spu2x will likely use it for assertions only.
TLS exhaustion creates issue to dlopen plugins
issue #384 : https://github.com/PCSX2/pcsx2/issues/384
But also for profiled build (-fprofile-generate)
http://forums.pcsx2.net/Thread-WORKAROUND-build-with-fprofile-generate
If someone have a better idea, please raise your hand!
The non-stdint fallback was not even working which shows that it was never used. No supported platform would not have stdint anyway.
Remove unused code and do not restrict types to Linux and MSVC. Was there a reason for this?
* Manually cast WxGetTranslation
* Accept string as format parameter of pxWindowTextWriter
* Manually convert wxString to wide string
Note: Wx setup.h is not the same between Debian and Arch. Unfortunately it
generated various compilations errors on wx code.
Close issue #172
This won't fix the billions of errors that will happen at runtime of using the x86 emitter, but chooses to make some better coding practice choices
that enables it to compile on x86_64.
in the xIndirectVoid class, instead of using s32 for the offset, use sptr which will be 32bit or 64bit depending on architecture.
This also fixes a few alignment issues in xAddressVoid's constructors.
In EmitSibMagic we are casting a void* to s32, which won't work on x86_64, so first do a cast from sptr to s32.
Won't work on x86_64, but gets us compiling.
Fixed clang build.
Note from Gregory:
C++ requests that at least 1 parameters is a class, an enumeration, or a
reference to those objects. Probably to avoid to screw basic type operation.
For example: *p += 4;
The realy buggy code was this one because T could be an int!
template T
f(*ptr, T)
To avoid any issue in the future the Team decide to drop all overload that use pointers.
This doesn't update the file to the latest version from mingw32 since this is already a custom header stripped from mingw32.
This also fixes the functions for x86_64(verified that it still works for both architectures) and also updates the version inside of GSdx.
Also removes a comment in the GSdx header saying that these functions are broken since they no longer are.
* Use c++11 static assert
* Properly cast to parameter template to u32 (help clang)
* Remove lots of useless ASM. Memset it only used with a size of 4096.
* check pthread_mutex_init status
The class already supports hashing 64bit values, just break it out to support it in this particular case.
From the 64bit version of the hash, this hash favours values that aren't on the extreme end.
Consdering that hashing is only really used by the class itself it isn't too big of an issue.
1/ initReadFifo will be first called on the GS thread
(openGL can only be done on the GS thread)
2/ readFifo will be called on the EE thread. It is not safe too access eeMem from GS
because of memory is virtual
Fix "recent" regression (crash) on Kingdom heart and others game too.
v2: add a len check on GSState::InitReadFIFO
* Fix some issue with the new debugger on linux
* Enable the previous tlb miss fix on the interpreter
* disable the building of po by default. It pollute too much my env.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5914 96395faa-99c1-11dd-bbfe-3dabce05a288
* use c++11 for pcsx2
* rename __rdtsc so I won't conflict with gnu version
* add a bunch of .data() method to get string data
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5913 96395faa-99c1-11dd-bbfe-3dabce05a288
memcards (mcd/mcr), Fixed issues with pad 2 (e.g. issue 1326).
These are changes which were left out at r5622, updated to pach v9 by KrossX from http://forums.pcsx2.net/Thread-Multitap-PCSX2 .
- Please report any issues with memcards corruption/incompatibilities here.
- Please feedback on multitap improvements here.
Thanks, KrossX! :)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5703 96395faa-99c1-11dd-bbfe-3dabce05a288
* remove unused variable
* move static function from h into cpp
* Initialized hw_by_page to 0xFFFFFFFF instead of -1 (number must be a positive integer)
* Use a s32 fore m_current_lsn instead of u32 (use -1 as error code)
Bonus: a couple of fix for clang compiler (doesn't mean that it fully compile with clang)
* remove useless __debugbreak on linux
* use short for 16bits atomic function
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5695 96395faa-99c1-11dd-bbfe-3dabce05a288
- Also, I slightly modified the default column widths at the memory card config panel.
- Tip: If the column widths are resized, the new widths will get saved after clicking OK/Apply, but NOT if clicking Cancel or closing the window with [X].
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5622 96395faa-99c1-11dd-bbfe-3dabce05a288
In this iteration, a simple read-ahead scheme is used where the next expected read begins as soon as the CDVD code calls FinishRead.
The expected improvement is close to 0 since a similar system is already in place in the core.
The next iteration should have an internal buffer, and use completion callbacks to initiate read-aheads as soon as the previous read is done, without waiting for the emulator to fetch the results of the previous operation.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5486 96395faa-99c1-11dd-bbfe-3dabce05a288
NOTE: The 'glew' project does NOT build yet, but it will have to be decided how to approach the problem (String literal too long in glew.rc)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5382 96395faa-99c1-11dd-bbfe-3dabce05a288
All UI percentage values (framerates, zoom) are saved incorrectly when the number ends with 0n (e.g. 105 is saved as 150, 307 is saved as 370, etc). The problem becomes apparent when these values are loaded from the ini file after restarting pcsx2.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5369 96395faa-99c1-11dd-bbfe-3dabce05a288
Translators note: I save previous translation but a careful review is mandatory
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5366 96395faa-99c1-11dd-bbfe-3dabce05a288
Threading VU1 took a lot of rewrites and new code to make possible (MTGS, microVU, gifUnit...), but we finally got to the point where it was feasible, and now we've done it! (so now everyone can stop complaining that pcsx2 only takes advantages of 2 cores :p).
The speedups in the games that benefit from it are great if you have a cpu with 3+ cores (generally a 10~45% speedup), however games that are GS limited can be a slowdown (especially on dual core cpu's).
The option can be found in the speedhacks section as "MTVU (Multi-Threaded microVU1)". And when enabled it should should show the VU thread-time percentage on the title bar window (Like we currently do for EE/GS/UI threads).
It is listed as a speedhack because in order for threading VU1 to have been a speedup, we need to assume that games will not send gif packets containing Signal/Finish/Label commands from path 1 (vu1's xgkick). The good news is very-few games ever do this, so the compatibility of MTVU is very high (a game that does do this will likely hang).
Note: vs2010 builds and Linux builds need to be updated to include "MTVU.h" and "MTVU.cpp".
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4865 96395faa-99c1-11dd-bbfe-3dabce05a288
Pcsx2 now has a gifUnit class which acts like the ps2's gif and executes a single gif transfer at a time (and performs path arbitration according to priority and path3 slicing).
This new code is generally a speedup for most games. Particularly VU heavy games like GoW.
This revision breaks old saved state compatibility so don't update if you wish to keep playing with your old saved states.
Leave comments if this revision fixes or breaks anything...
Message to GS Plugin authors:
This new code now uses only 1 gif callback to transfer data to the gs plugin (GSgifTransfer).
pcsx2 also is garaunteed to send full GS primitives to the plugin. So you don't have to account for partial-transfers anymore.
Thanks goes out to shadowlady who tested around 500 games for me :D
Note 1: The old gif code is still in this revision, and can be enabled by the USE_OLD_GIF macro. The old code will be deleted soon.
Note 2: This revision also enables assertion dialogs in devel builds, and changed a lot of assume cases into assertions.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4821 96395faa-99c1-11dd-bbfe-3dabce05a288
* Gsopen2 support for GS plugins => Support of the PCSX2 GS window configuration panel. Support of all PCSX2 shortcut.
* new shortcut: shift-f12 to stole the input. ZZogl shortcut must be prefixed with ctrl
* onepad: Support/fix/improve of configuration gui, multiple key, mouse/wiimote for analog joystick, dualshock3/sixaxis (basic), dual pad and experimental forcefeedback
Note: it is advices to delete OnePAD.ini
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4731 96395faa-99c1-11dd-bbfe-3dabce05a288
- Reimplemented mini/max opcodes using integer comparison operations instead of double comparison. This results in a bit less code and integer operations tend to be faster than double ops (especially on AMD cpus). Thanks to pseudonym for the idea!
- Fixed some minor bugs in mVU dev builds.
pcsx2:
- Added __fc as a shorthand macro for __fastcall since we already have __ri and __fi macros.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4713 96395faa-99c1-11dd-bbfe-3dabce05a288
Details:
The major differences between install and portable modes should now be:
1. Portable mode doesn't use the registry at all.
2. Portable mode uses the folders inside pcsx2 folder as default (install mode has some default at "my documents").
3. Portable mode tries to save relative paths at the ini file where possible*.
Specifically, portable mode now allows to select custom folders for plugins, bios, etc via the standard UI, which allows using several portable pcsx2 folder sharing the same resources (bios, iso, memcards, etc).
* Relative paths where possible = the following sequence (thanks to pseudonym for the brilliant idea):
1. If the file/folder is inside pcsx2 folder, it's saved as completely relative (to pcsx2.exe)
2. Else, if the file/folder is at the same drive as pcsx2.exe, it's saved as absolute path without the drive letter (e.g. /ISO/...)
3. Else, saved as absolute path, including the drive letter (for linux, without drive letter naturally).
This allows to create a removable drive with (one or more) pcsx2 folder on it, configure all the files/folders to point to the same drive (ISOs, save states, etc), and then take this drive, plug it into another computer (where it will be assigned with a different drive letter), and everything will continue working.
Please test it if you can. Bugs here can be inconvenient...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4507 96395faa-99c1-11dd-bbfe-3dabce05a288
* PCSX2 now splits settings into two files: pcsx2-ui.ini and pcsx2-vm.ini. The former is user interface clutter (window positions, confirmation dialogs, etc). The latter is virtual machine settings, speed hacks, game fixes, etc.
* Added support for PORTABLE INSTALLS!! Portable install is currently manually enabled by adding an empty "pcsx2-portable.ini" to the install location of PCSX2. Portable installs should run seamlessly from any flash drive, etc. (and will usually need Admin rights)
* PCSX2 install location and plugins folders are stored in the registry now (unless portable install is enabled, in which case no registry is used).
Notes:
* A button to enable portable installs from within PCSX2 is planned.
* NSIS installer will hopefully be upgraded to allow for a portable install option as well.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4198 96395faa-99c1-11dd-bbfe-3dabce05a288
* Moved VIF dynamic recompiler buffers to the recompilers section of PCSX2.
* Using RecompiledCodeReserve for the VIF SSE functions.
* Minor bugfixes to VirtualMemory class implementations.
* Improved error handling and error message display.
* [TODO] : implement a call to cpuShutdown() to clean up VIF unpack/SSE reserves.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4169 96395faa-99c1-11dd-bbfe-3dabce05a288
* A couple i18n fixes listed in Issue 915, relating to dialog message formatting for a couple specific messages.
DevNote:
* Added some missing operator+() stuff for the pxsFmt string formatter.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4160 96395faa-99c1-11dd-bbfe-3dabce05a288
* Simplified and improved (slightly) the savestate memory cleanup on error/cancellation.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4158 96395faa-99c1-11dd-bbfe-3dabce05a288
* Finished up zipfile-style savestate implementation
* Simplified BaseSaveState class, and removed lots of now-unneeded code.
* Prepared the i18n stuff for a pcsx2_Dev.pot file (WIP), and sorted more stuff to pcsx2_Tertiary.pot.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxSavestates@4091 96395faa-99c1-11dd-bbfe-3dabce05a288
* "Browse" option in recent iso menu should translate now.
* Dialogs and config panels remember their positions more reliably (when using X or alt-F4 to close PCSX2, for example).
* Preliminary language selector dialog (available in debug builds only). Will finish it up later.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4088 96395faa-99c1-11dd-bbfe-3dabce05a288
* fixed a bug that caused certain confirmation dialogs to not remember their choices, when user had non-english language.
* Added wxWidgets-provided strings for a few things, such as Next, Back, and OK / Apply / Cancel.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4076 96395faa-99c1-11dd-bbfe-3dabce05a288
* PCSX2: Added GSgetTileinfo2 and deprecated=removed GSgetTitleInfo
* GSdx: moved to the new GSgetTitleInfo2
* New PCSX2 with new GSdx will have the new functionality, all other combos remain with old functionality.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4073 96395faa-99c1-11dd-bbfe-3dabce05a288
* Added logging of host operating system and physical ram to startup.
* Removed "PhysicalCores" stuff from both x86emitter and startup logs -- physical cores is losing its relevance with all the new AMD and Intel chip designs.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4048 96395faa-99c1-11dd-bbfe-3dabce05a288
* Basic savestate loading/saving working now (needs testing).
* No support for screenshots embedded into the savestate (yet).
git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxSavestates@4043 96395faa-99c1-11dd-bbfe-3dabce05a288
* PCSX2 uses significantly less memory when starting.
* Overall memory use reduced (mildly for some games, significantly for most).
* EE and IOP main memory are now fixed at 0x20000000 and 0x24000000 -- useful when using external cheat apps.
* Properly implemented the 'Shutdown' menu option -- Shutdown now unloads the entire PS2 virtual machine and reduced PCSX2's memory footprint to bare minimums.
* Some more meaningful errors for when memory is a problem (out of memory, low virtual memory, etc).
* Bugfix for pxsFmt when formatting long/large strings (over 1k)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4029 96395faa-99c1-11dd-bbfe-3dabce05a288
* Applied the new RecompiledCodeReserve to the VIF recompilers (saves another 4-8mb of memory, depending on game).
* Fixed a bug in pxsFmt / FastFormatUnicode (string formatting).
* Final round of error handling cleanups.
(branch is basically ready for re-integration -- needs some testin for obvious/show stopping bugs, thanks!)
git-svn-id: http://pcsx2.googlecode.com/svn/branches/newHostVM@4025 96395faa-99c1-11dd-bbfe-3dabce05a288
* Added some bounds checking to debug builds for VTLB mappings.
* Fixed a VU mapping bug that caused boot crashing
* Fixed some startup, shutdown, and reset resource management.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/newHostVM@4021 96395faa-99c1-11dd-bbfe-3dabce05a288
* Preliminary implementation for the SpatialArrayReserve class, which will be used for recompiler lookup tables (large portions of these tables are never used by many games). Will put it to use and test it soon.
* Finished implementation of TryResize method for reservations, which will be used by PCSX2 if the operating system runs low on ram.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/newHostVM@3992 96395faa-99c1-11dd-bbfe-3dabce05a288