Commit Graph

93 Commits

Author SHA1 Message Date
zeromus 9d831d8b8b ok, I realized we need to realloc buffers allocated by FCEU_malloc (why didn't I guess that..) which makes the fact that they're aligned be horrible. so I added FCEU_amalloc and FCEU_afree instead to do aligned allocs and frees. 2022-08-28 04:31:34 -04:00
zeromus ff633d5acd add new function FCEU_abort() for calling abort() with a message; use it when memory allocation fails instead of exit() 2022-08-23 22:01:29 -04:00
zeromus 96e570ae44 don't doubly memzero new allocations 2022-08-23 21:48:32 -04:00
zeromus 179a5f0ffa fix the size parameter of newly-introduced aligned_alloc call to be properly aligned (as the api requires) 2022-08-23 21:28:15 -04:00
harry b97b24a5e9 Fix for unix build, aligned_free does not exist in unix should use plain free instead. 2022-08-23 18:18:25 -04:00
zeromus 892e7cb5f5 change how memory is allocated to clean up a lot of messed up junk (mainly strange alignment adjustments which didnt completely make sense and frees which didnt match the allocation function that was used).
In case there are problems on other platforms (a few seems probable), here's the idea
1. Get rid of all manual alignment adjustments
2. use FCEU_malloc or malloc, as you see fit
3. use FCEU_free (or FCEU_gfree) if you use FCEU_malloc or FCEU_gmalloc. There's no real reason to need FCEU_gfree; this rule might be eliminated in the future (at which time FCEU_gfree will be removed)
4. If you need more alignment, increase it in FCEU_malloc. It's unlikely more alignment will ever be needed.

On windows, since the FCEU_*malloc functions now use aligned_alloc, we will catch instances where free() is used to free them (which happens frequently). allocates and frees should be matched. fix the free call if you ever observe this happening.

also

5. In general, remove crufty error handling for allocation failures. This just gunks up the code. If allocation fails, the application terminates.
2022-08-22 22:53:09 -04:00
mjbudd77 bc3b156cf5 Compiler warning cleanup of unused variables and exception handling. 2021-03-19 20:59:03 -04:00
mjbudd77 24863422ff Lua Qt Win build fixes. 2021-02-07 12:23:31 -05:00
mjbudd77 314e3d90a1
Removed unused deprecated automake build files. (#297) 2021-01-06 21:21:35 -05:00
mjbudd77 9e781da116 Removed unused/deprecated scons and automake build files from project. SDL uses cmake now and its never going back. 2020-12-10 21:55:38 -05:00
Matthew Budd 7919071a25 Cleaned up gcc compiler warning : ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 2020-06-19 23:58:12 -04:00
Matthew Budd 70a804e90f Fixed a few code errors identified by cppcheck static code analyzer.
Fixed incorrect error handling of realloc function to prevent memory leak.
Fixed a few uninitialized local stack variables.
Changed (1 << 31) to (1u << 31) to fix error stating that a signed 32 bit integer shifted by 31 bits can result in undefined behavior.
2020-05-08 23:30:31 -04:00
Brad Smith 5be92d3ee5
Propagating memory initialization option to WRAM (#13)
1. Including WRAM in the RAM initialization options. Since it was usually initialized to zero by default, the "default" setting must do that as well, the explicit settings should follow the others.

2. unif.cpp extending memory randomization of 4-screen VRAM to match ines.cpp version, except it had no explicit initialization before: static array should initialize to 0, so its default will still do this

3. MALEE WRAM never initialized, replacing a few existing explicit (non gmalloc) WRAM clears with MemoryRand, removing a few memsets now unneeded because of gmalloc clear.
2018-06-26 22:11:01 -04:00
zeromus 4245280271 apply patch #827 : Fix "non-constant-expression cannot be narrowed from type" compile error 2018-05-31 12:52:38 -04:00
zeromus 0307e3b827 migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
punkrockguy318 2be5084a7b create new subversion repo structure (trunk, tags, branches)
[[Split portion of a mixed commit.]]
2013-03-15 19:00:14 +00:00
punkrockguy318 0d1d24e153 sdl: integrate backward-cpp (https://github.com/bombela/backward-cpp) to generate more helpful debugging output 2013-03-15 18:22:38 +00:00
punkrockguy318 99ff252145 fix end-of-lines (dos2unix) 2013-03-11 02:29:15 +00:00
punkrockguy318 7bfd254ba0 forgot to add this to previous commit 2013-03-11 01:51:02 +00:00
punkrockguy318 bdbcc524bf scons: don't compile minizip files whatsoever when SYSTEM_MINIZIP enabled 2013-03-11 01:37:17 +00:00
punkrockguy318 87b850f9f7 updated utils to use minizip 1.2.7 2013-03-10 19:59:33 +00:00
punkrockguy318 969258d32a scons: dynamically generate the build source list 2012-12-01 21:54:02 +00:00
punkrockguy318 449ac4352f updated FSF license in COPYING license file and source and header files 2012-08-04 22:33:16 +00:00
zeromus 1d373efe0d hopefully fix compilation on new gcc by fixing unused template function with bugs in it 2012-04-07 18:33:25 +00:00
CaH4e3 75e13fd152 fix to previous 2012-03-17 18:03:23 +00:00
CaH4e3 565f063fa5 varous bugfixes, xstring trimming functions logic bugs, etc
some refactoring, some wtfs... ;)
2012-03-17 16:29:56 +00:00
ansstuff ec37ecd417 * Tasedit: fixed selection bugs in Set Marker, SelectMidMarkers and DeleteFrames
* Tasedit: Edit->Clone Frame(s) (Shift-Insert)
* Tasedit: 7 digits in Frame#
* utils\xstring.cpp: new U32ToDecStr
2011-10-03 17:29:33 +00:00
zeromus 195528abc5 unify emufile across emulators 2010-11-07 23:33:11 +00:00
qeed 0d63ef203a added wrapper around places that uses malloc to use FCEU_dmalloc, for debugging purpose if the need comes up 2010-09-19 00:00:38 +00:00
adelikat 1cd34b57ea Win32 - Add movie filename at the top of the main window, did this by creating a SetMainWindowText() function that sets it based on various conditions, this allowed some nice code cleanup on the various places that set the window text. Also removed an unused and useless prototype from movie.h 2010-08-21 03:59:17 +00:00
zeromus 0f873d9812 fix crash in fcm convert 2010-06-01 00:53:52 +00:00
qeed 11e94c3e99 fixed 2 compile errors for gcc, more awaits.. 2010-05-18 18:22:20 +00:00
zeromus 4e66aaef9c replace most of the crappy iostream stuff with EMUFILE 2010-05-17 21:02:38 +00:00
rheiny 0de4ad663e Fixed reported issue 2746924 (md5_asciistr() doesn't produce correct string) 2009-06-06 14:36:41 +00:00
shinydoofy 67c9ed20fd SDL - hotkey Q for toggling read-only/read+write 2009-04-11 03:26:36 +00:00
shinydoofy 209c02ef98 SDL: optimized UTF8<->UTF32 code a little, removed ifdefs and so on 2009-04-04 19:35:24 +00:00
shinydoofy f3be58f2a6 SDL: fixed fcm->fm2 once again. no more NULLbytes 2009-04-04 14:04:36 +00:00
shinydoofy 1255f3fd74 fixed NULLbytes for win32 for now by reverting my changes 2009-04-04 09:05:00 +00:00
shinydoofy 5d95228971 SDL: fix crash with fm2 and fcm->fcm conversion 2009-03-28 20:53:21 +00:00
punkrockguy318 982facdad7 fix compile errors with gcc 2008-12-19 02:29:39 +00:00
zeromus 551cb8e866 clean up header file, for fewer dependencies and hopefully slightly faster builds. also fix a couple of const arrays which were being defined in a .h file 2008-12-13 02:47:07 +00:00
zeromus cf93b5b102 more endian fix 2008-11-09 01:54:15 +00:00
zeromus 2cba0fd439 support autoloading from archives in cases where there is only one useful file in an archive.
add experimental ram-only emulua savestate code. now call savestate_persist(ss) if you want to cause it to go to disk. otherwise it will stay in memory. this might speed things up. also add experimental new ppu which can be enabled by newppu 1 in configfile. there is no reason to use it yet but i needed to do a checkin
2008-08-18 03:11:42 +00:00
zeromus 224d9268ef handle a crash condition when I receive non-convertible utf-8 text 2008-08-17 19:27:58 +00:00
punkrockguy318 17df29de0f fixed build error (header include missing) 2008-08-12 05:04:40 +00:00
zeromus f73de3b31e restore IPS patching capability which was lost when archive support was added 2008-08-12 04:57:15 +00:00
punkrockguy318 6cf8efd2de Sconstruct update:
Better detection of liblua library 
Warns linux users if zenity is not installed

also got convertUTF to compile in linux
2008-08-10 09:34:45 +00:00
zeromus 41863383eb SF [ 2030405 ] Avi recording: no sound b0rks format 2008-08-10 08:59:23 +00:00
zeromus 19100f0259 sturdier fm2 loader 2008-08-10 04:28:53 +00:00
zeromus 3a0b893662 first attempt - support loading movies from archives. 2008-08-10 02:33:14 +00:00