Commit Graph

12927 Commits

Author SHA1 Message Date
David Korth
bf70f98233 Use TARGET_INCLUDE_DIRECTORIES() instead of INCLUDE_DIRECTORIES().
Increased the CMake version requirement to 2.8.12.

Added QT4_NO_LINK_QTMAIN and Qt5_NO_LINK_QTMAIN, even though the
KDE plugin isn't going to be built on Windows.

Added -DQT_NO_DEBUG for release builds.
2016-07-21 21:29:08 -04:00
David Korth
db904b3295 [libromdata] Removed the old direct fields from MegaDrive.
Only the base RomData field accessors can be used now.

Combined the original MegaDrive code with the RomData code so it
adds the fields as it parses the header.

byteswap.h: Add casts to __swab16() and __swab32() to get rid of
some warnings caused by printf format strings.

[kde] Removed MegaDriveView.
2016-07-21 21:25:47 -04:00
David Korth
149ef48edb [libromdata] MegaDrive: Added the remaining numeric and range fields.
TODO: Add a helper for ranges? (Maybe...)

The RomDataView display is now identical to MegaDriveView.
2016-07-21 21:15:12 -04:00
David Korth
dedc1ea01e CMakeLists.txt: Build the Debug build by default.
On my ThinkPad T60p, it's defaulting to Release. On a Kubuntu 16.04 VM,
it was defaulting to "none", so it didn't add debug flags, and it didn't
add release flags, either.

TODO: Switch the default to Release later?
2016-07-21 20:41:18 -04:00
David Korth
caeee3965c [libromdata] Added some convenience functions.
- RomData::addField_string_numeric(): Add a numeric field as a string,
  with support for decimal, hexadecimal, and octal, and a leading
  digit specifier.

- ascii_to_rp_string() Fast function that converts 7-bit ASCII to
  rp_string. (Do NOT use Latin-1 or UTF-8 here!)

Updated MegaDrive to use these functions where appropriate, including
the checksum field.
2016-07-21 20:36:44 -04:00
David Korth
8b34d1785b [kde] RomDataView: Implemented RFT_BITFIELD display.
RomDataView now shows I/O support for Mega Drive ROMs.

RomData:
- Added helper function for bitfields.
- Added elemsPerRow for bitfield display.
2016-07-21 20:25:29 -04:00
David Korth
5479c0fee7 [kde] Fix the automoc #include for the plugin factory files.
This only affected the KDE5 build, but the KDE4 file has a commented-out
line that matches it.
2016-07-21 20:17:54 -04:00
David Korth
9d9d29326b [kde] RomDataView.cpp, rpToQS(): Use string::data() instead of c_str().
data() doesn't have to ensure that the string is NULL-terminated,
and since we're using an explicit size here anyway, we don't need
to use c_str() to ensure the presence of the NULL terminator.

(...actually, do any current C++ STLs handle data() like that?)
2016-07-21 01:23:56 -04:00
David Korth
5918b7356d [kde] RomDataView: New QWidget that builds the UI based on RomData fields.
RomPropertiesDialogPlugin currently adds two tabs:
- MegaDriveView ("ROM Properties")
- RomDataView ("RomDataView")

This is only being done for comparison purposes. Once RomDataView is
finished (and LibRomData::MegaDrive is fully updated), MegaDriveView
will be removed.

So far, all strings prior to "Checksum" show up as expected.
2016-07-21 00:22:04 -04:00
David Korth
dea2527d83 README.md: Updated for KDE 5.x; fixed kdelibs dev package for KDE 4.x. 2016-07-20 23:43:59 -04:00
David Korth
0481591a17 [libromdata] RomData: Initial RomData base class.
This class defines the types of fields and will be populated by
subclasses in order to allow a more generic UI to be written,
instead of having to write one UI per platform per ROM type.

MegaDrive currently fills in the field types and adds the string
fields, but not the numeric fields or bitfields.

TextFuncs: New functions for rp_char/rp_string:
- rp_strlen()
- rp_strdup() - returns an rp_char* duplicate.
2016-07-20 23:32:33 -04:00
David Korth
f27bc9d94e Renamed the libromdata target to just "romdata8"/"romdata16".
This makes sure the library filename is "libromdata8", not "liblibromdata8",
and same for "libromdata16" instead of "liblibromdata16".
2016-07-20 23:08:29 -04:00
David Korth
689ffd05f0 [libromdata] New macro _RP().
This is similar to the Windows macro _T(), except it uses rp_char
instead of TCHAR.

MegaDrive, MegaDrivePublishers: Use _RP() to store native UTF-16
(and UTF-8) strings depending on build type. This reduces runtime
conversion overhead and simplifies the code a bit.
2016-07-20 23:04:10 -04:00
David Korth
4c5122d7de Added preliminary KDE5 support.
Split RomPropertiesDialogPluginFactory into separate files. Note that
separate files are needed for KDE4 and KDE5 due to changes in automoc.
automoc4 complains if it has an #include for .moc, whereas automoc5
doesn't recognize that K_PLUGIN_FACTORY() has a Q_OBJECT macro, so it
fails to link due to undefined references to a vtable.

cmake/options.cmake: Added BUILD_KDE4 and BUILD_KDE5 options.
Both default to ON, but if the dependencies are missing, then their
respective plugins won't be built.
2016-07-20 22:53:31 -04:00
David Korth
d28469d3b4 SplitDebugInformation.cmake: Fix the GNU debug link parameter.
KDE4_ADD_PLUGIN() builds the library in build/lib/ instead of
build/src/kde/, so objcopy couldn't find the .debug file.

Note that objcopy only embeds the filename portion, not the full path,
so this won't cause any problems when debugging.
2016-07-20 22:32:15 -04:00
David Korth
8829aab9c6 Install debug files if INSTALL_DEBUG is specified.
Use GET_TARGET_PROPERTY() instead of GET_PROPERTY().

Various other adjustments to improve debug file installation.
2016-07-20 02:27:03 -04:00
David Korth
734bd7de97 SplitDebugInformation.cmake: Set a target property containing the debug filename. 2016-07-20 02:19:29 -04:00
David Korth
f351549a94 Enable split debug symbols.
Minor change in SplitDebugInformation to handle CMake linking the
shared library in build/lib/ instead of build/src/kde/.

Added options for SPLIT_DEBUG and INSTALL_DEBUG, though INSTALL_DEBUG
isn't currently used.
2016-07-20 02:16:38 -04:00
David Korth
9cbf85af04 [libromdata] MegaDrivePublishers: Added a list of Mega Drive publishers.
Reference: http://segaretro.org/Third-party_T-series_codes

MegaDrive: Parse the copyright line to determine the publisher.

TextFuncs: New function utf8_to_rp_string(). This is effectively a no-op
in the RP_UTF8 build, and converts UTF-8 to UTF-16 in the RP_UTF16 build.

[kde] MegaDriveView: Renamed company to publisher, and moved it to right
below the copyright label.
2016-07-20 02:08:07 -04:00
David Korth
3d0c2585d6 [kde] Use libromdata16 instead of libromdata8.
Qt uses UTF-16 natively, so using libromdata16 is faster and requires
fewer UTF conversions.

rpToQS(): Inline function to make it easier to convert from rp_string
to QString.
2016-07-20 00:46:18 -04:00
David Korth
6ce08164da [libromdata] Build two versions: UTF-8 and UTF-16.
Two new types based on the build type:
- rp_char: char type
- rp_string: string type

TextFuncs: New function cp1252_sjis_to_rp_string() that attempts to
convert from Shift-JIS to rp_string. If that fails, it converts from
cp1252 instead.

Text conversion functions copied from Gens/GS II.

[kde] Link to libromdata8. (TODO: Link to libromdata16 instead.)
2016-07-20 00:40:10 -04:00
David Korth
a88c8f72d8 Added a quick README and the GPLv2+ license. 2016-07-19 23:59:07 -04:00
David Korth
5b8fb8e945 Added CMake macros and C++ 2011 compatibility files from Gens/GS.
Some stuff was stripped out, including support for ANSI Windows.
The minimum version I'm officially going to support once I add
Windows support is XP, though 2000 might "just work".
2016-07-19 23:47:51 -04:00
David Korth
19b2eea6c5 [kde] MegaDriveView: Display most of the information.
SRAM information isn't displayed yet, and Shift-JIS ROM names aren't
decoded correctly.
2016-07-19 23:32:20 -04:00
David Korth
314b2cd68f [kde] MegaDriveView: Added a UI for LibRomData::MegaDrive.
It currently doesn't show anything yet, but it now shows up if it
detects that the ROM is a Sega Mega Drive ROM.

MegaDrive: Added the implementation for isValid() and removed the
declaration for ~MegaDrive().
2016-07-19 23:19:07 -04:00
David Korth
362f642368 New library libromdata.
The first class in libromdata, MegaDrive, parses Mega Drive ROM headers.
It's not complete yet, but it's usable.

TODO:
- Decode cp1252/shift-jis to UTF-8/UTF-16.
- Build UTF-8 (GTK+) and UTF-16 (Qt, Windows) libraries.
2016-07-19 23:05:19 -04:00
David Korth
3f9a02b05b Initial commit of the ROM Properties Page shell extension.
The initial version adds a blank "ROM Properties" tab to the
file properties dialog in KDE4.

NOTE: KDE4 on my system doesn't seem to look in /usr/local, so the
plugin must be installed in /usr in order to work.
2016-07-19 22:17:36 -04:00