Commit Graph

142 Commits

Author SHA1 Message Date
Ori Avtalion
4d485fc741 BACKENDS: Fix compilation for various backends
Affects:
* PS2
* GPH
* ELF
* MOTO
* IPHONE
* N64
* DINGUX
* WINCE
* PSP
2011-04-28 23:24:06 +03:00
Ori Avtalion
9414d7a6e2 JANITORIAL: Reduce header dependencies in shared code
Some backends may break as I only compiled SDL
2011-04-28 15:08:58 +03:00
Marcus Comstedt
21421d2e86 DC: Move dynamic plugin handling into the platform 2011-04-20 23:46:44 +02:00
Max Horn
42ab839dd6 AUDIO: Rename sound/ dir to audio/
svn-id: r55850
2011-02-09 01:09:01 +00:00
Yotam Barnoy
7558331550 PLUGINS: rename ONE_PLUGIN_AT_A_TIME define to UNCACHED_PLUGINS
ONE_PLUGIN_AT_A_TIME is too long.

svn-id: r55064
2010-12-30 08:01:58 +00:00
Yotam Barnoy
8f36a5f887 PLUGINS: single plugin model now saves plugin filename to config file
After searching for the right plugin once, the filename will be saved to the config file under the domain 'plugin_files'. The key is the gameid and the value is the plugin file. The backup mechanism is searching plugin by plugin.

svn-id: r55061
2010-12-29 15:25:21 +00:00
Yotam Barnoy
4f36239644 PLUGINS: fixed resource leak that caused PSP to crash
The leaky file handles didn't show up when debugging using the shell since that uses the Windows file handles, of which there are many more.

svn-id: r55048
2010-12-26 20:44:19 +00:00
Yotam Barnoy
a79ccfed55 PLUGINS: replace all size_t's with uint32's and add #include <malloc.h> to memory manager
uint32 is all we need since we only handle ELF32 anyway.

svn-id: r55012
2010-12-22 15:33:46 +00:00
Johannes Schickel
0134ffd86e PLUGINS: Only enable ELFMemoryManager when dynamic plugins and the ELF loader is enabled.
This should fix compilation on desktop systems, where for example memalign
is not present.

svn-id: r55011
2010-12-22 15:09:42 +00:00
Johannes Schickel
48ce90419f PLUGINS: Fix ELFMemoryManager::pluginAllocate signature.
svn-id: r55010
2010-12-22 15:07:14 +00:00
Yotam Barnoy
6817d4b300 PLUGINS: add ELF memory manager to solve fragmentation
Following lordhoto's suggestion, I implemented a simple allocator that grabs the size of the biggest available plugin in memory. This is an elegant solution to the fragmentation problem, with the caveat that memory is wasted. As such, it's not suited for the DS, so I added a #define to disable it there.

svn-id: r55009
2010-12-22 14:48:51 +00:00
Johannes Schickel
a1d99836cd BACKENDS: Fix SVN keyword usage.
svn-id: r54584
2010-11-29 18:48:43 +00:00
Max Horn
df05ed1a46 BACKENDS: Include scummsys.h at top of all .cpp files, *before* any #ifdefs
svn-id: r54573
2010-11-29 16:18:43 +00:00
Max Horn
4e0e406181 SDL: Move #include <SDL.h> into a special wrapper file
svn-id: r54572
2010-11-29 16:16:50 +00:00
Max Horn
7ace85e636 PLUGINS: Simplify ELF plugin providers & DLObject subclasses
* Remove DLObject virtual methods allocSegment and freeSegment.
  As long as all DLObject implementations use memalign + free to
  allocate/release segments, there is no point in wrapping those.
  This enables further simplifications.
* Add TemplatedELFPlugin template class. Use this instead of explicit
  ELFPlugin subclasses.
* Rename DLObject::discard_symtab to discardSymtab

svn-id: r54082
2010-11-05 01:20:34 +00:00
Max Horn
102e7ee88c PLUGINS: Add EM_SH to elf32.h (e_machine type used by DC backend)
svn-id: r54081
2010-11-05 01:19:45 +00:00
Yotam Barnoy
f5bfae598c PSP: cleaning up some stuff from plugin merge
svn-id: r54060
2010-11-04 06:28:34 +00:00
Max Horn
99cf0e3936 COMMON: Undo changes to common/ptr.h, remove Common::ScopedPtrC
The deletePointer() method approach cannot work, as it is called
by the destructor of the base class.
A possible correct solution would be to enhance ScopedPtr with a
"deleter" object like SharedPtr. But this seems overkill as long as we
need it in only one place.

svn-id: r54057
2010-11-04 00:49:12 +00:00
Yotam Barnoy
13b904d282 Merge from gsoc2010-plugins
This merge was extremely difficult to carry out. It wasn't entirely SVN's fault -- there were several merges to the branch that were done by hand. Please check for any issues and regressions. Also note that the DS makefile was not copied over since the "one at a time" plugin mode currently has too much fragmentation ie. it doesn't work.

svn-id: r54051
2010-11-03 22:01:01 +00:00
Yotam Barnoy
e56a3747d2 Dummy file creation through SVN to allow merging gsoc plugins via mercurial
svn-id: r54046
2010-11-03 06:23:16 +00:00
Yotam Barnoy
94c8d0a14d Updated with latest from trunk
svn-id: r53976
2010-10-31 11:08:43 +00:00
Max Horn
6ea76cd913 SDL: Fix SDL plugin provider code (used e.g. by Dingux port)
svn-id: r53968
2010-10-30 23:53:30 +00:00
Yotam Barnoy
8df4278ba8 PLUGINS: fixed issue with R_MIPS_32 relocations
Caused crash in some games. The problem was referring to the right segment. R_MIPS_32 relocations can be found in the Shorts segment, but still need to refer to the main segment if the symbol is found there.

svn-id: r52750
2010-09-16 17:37:54 +00:00
Yotam Barnoy
09cb941690 PLUGINS: Fix function arguments in MIPS loader
Derived virtual function wasn't overwriting base function.

svn-id: r52749
2010-09-16 17:37:31 +00:00
Andre Heider
2596143e2b PLUGINS: Additional plugin check for the ELF loader.
The ELF loader does not have access to the symbols of the main
executable, it just relocates symbols to it via fixed offsets. We need
to make sure that loaded plugins are from the same link process to
prevent crashes. An embedded build date is used for that.

svn-id: r52730
2010-09-15 07:44:08 +00:00
Andre Heider
41834499ed PLUGINS: Cleanup.
- Unify ELF loader handling in configure
- Rename ELF_LOADER_TARGET to USE_ELF_LOADER

svn-id: r52728
2010-09-15 07:43:16 +00:00
Andre Heider
83a931dac0 PLUGINS: Only resolve __dso_handle if loading was successful.
svn-id: r52612
2010-09-06 22:17:46 +00:00
Andre Heider
d3ea6265ba PLUGINS: Formatting.
svn-id: r52611
2010-09-06 22:17:23 +00:00
Andre Heider
ae408db07f PLUGINS: Use the C++ ABI to call dtors when unloading a plugin.
Avoid linking all plugins against libstdc++ to free up some memory
(about ~40kb on Wii per plugin). Enable it on GameCube, Wii, DS and PSP
(PS2 doesn't have __cxa_atexit support in its libc).

svn-id: r52607
2010-09-06 20:34:00 +00:00
Yotam Barnoy
c2cafe426e PLUGINS: used variation of ScopedPtr to clean up load() function
svn-id: r52592
2010-09-06 13:31:27 +00:00
Yotam Barnoy
b77fd21969 PLUGINS: fixed MIPS plugin loader
Adjusted to new VMA handling and fixed a few errors which caused crashes. Also removed unneeded expansion of alignment value.

svn-id: r52589
2010-09-06 12:04:30 +00:00
Yotam Barnoy
a3190a5bb5 PLUGINS: added missing call in destructor which caused crashing
svn-id: r52588
2010-09-06 12:03:15 +00:00
Andre Heider
cd5e62bbe8 PLUGINS: Added _segmentVMA to the MIPS loader.
Also added 2 TODOs for all loaders not respection that offset.

svn-id: r52577
2010-09-05 22:00:41 +00:00
Andre Heider
364acaae45 PLUGINS: Remove spurious extra allocation.
Elf32_Phdr.p_align is to align the memory location of the loaded
segment, not to extend its size. The size of the scratch area
(like .bss and .sbss) is p_memsz-p_filesz, which has to be set to
zero by the loader.

svn-id: r52576
2010-09-05 22:00:19 +00:00
Andre Heider
4c7f5084c2 PLUGINS: Plug some memleaks.
svn-id: r52575
2010-09-05 21:59:50 +00:00
Andre Heider
a4c9de25e6 PLUGINS: Move doxygen to the base class header.
No point in documenting it on every derived class.

svn-id: r52574
2010-09-05 21:59:29 +00:00
Andre Heider
a318934e45 PLUGINS: Add missing variable initialization.
svn-id: r52573
2010-09-05 21:59:07 +00:00
Andre Heider
d8b85ffcb8 PLUGINS: Formatting.
Misformatted casts in an earier commit, oops.

svn-id: r52572
2010-09-05 21:58:45 +00:00
Andre Heider
8889f4c5ad PLUGINS: Set svn:keywords property on all new files.
svn-id: r52566
2010-09-05 15:47:04 +00:00
Andre Heider
402c71860f PLUGINS: Make the file stream a member of DLObject.
No point in passing it to functions all over the place. Release the
stream when it's not required anymore.

svn-id: r52558
2010-09-05 12:53:15 +00:00
Andre Heider
3b2a9734d1 PLUGINS: Type cleanup.
Use our types, get rid of some casts.

svn-id: r52557
2010-09-05 12:52:49 +00:00
Andre Heider
c4a88559a5 PLUGINS: Move platform specific code out of the generic ELF loader.
Instead overwrite pure virtual functions in a backend specific class.

svn-id: r52556
2010-09-05 12:52:17 +00:00
Andre Heider
86f4dbd956 PLUGINS: Move all ELF loader related files to its own directory.
svn-id: r52555
2010-09-05 12:51:25 +00:00
Andre Heider
13770ce9cd PLUGINS: Plugin support for the GameCube/Wii backend.
svn-id: r52553
2010-09-05 12:49:29 +00:00
Andre Heider
5986aa96f2 PLUGINS: Formatting.
svn-id: r52552
2010-09-05 12:39:28 +00:00
Andre Heider
c5a189f4d5 PLUGINS: Respect the VMA when relocating.
Plugins do not have to be linked at 0x0. Some platforms have limited
relocation jump offsets, which makes 0x0 unusable.

svn-id: r52551
2010-09-05 12:38:58 +00:00
Andre Heider
ee2f4ef189 PLUGINS: Properly check the ELF header.
The ELFMAG is only 4 bytes, not 6. Properly check for endianess.

svn-id: r52550
2010-09-05 12:38:38 +00:00
Andre Heider
628842d457 PLUGINS: The VMA doesn't get added to any PHDR.
svn-id: r52549
2010-09-05 12:38:18 +00:00
Andre Heider
253a0aa7f9 PLUGINS: Fix warnings.
svn-id: r52548
2010-09-05 12:37:59 +00:00
Andre Heider
07e3a42224 PLUGINS: Cleanup includes and debug output.
Use the common debug functions instead of spamming #defines.

svn-id: r52547
2010-09-05 12:37:36 +00:00