Commit Graph

62 Commits

Author SHA1 Message Date
Olivier Galibert
e4564eb99a cdrom_file: classify. Could use more internal work, but it's a step 2022-04-01 11:36:55 +02:00
Logan B
318a686962
chdman.cpp: correct copy-paste comment (nw) (#8936) 2021-12-04 22:46:47 -05:00
Vas Crabb
aeb9eae874
util: Further API cleanups: (#8661)
* Turned `core_file` into an implementation of `random_read_write`.
* Turned PNG errors into a standard error category.
* Added a helper for generating what look like derived classes on-the-fly.
2021-10-05 03:34:45 +11:00
Vas Crabb
4f495994c4 -ui: Made zoom controls a bit more intuitive.
* The UI controls are described as zoom in/out, but they had the
  opposite effect on the palette and tile viewers.  That has been
  changed to make them consistent with the tilemap viewer.
* Made the default zoom key not act as a toggle.  People are familiar
  with the function of Ctrl+0/=/- in web browsers, so making them behave
  similarly in MAME should make it more approachable.  Also added the
  default zoom key to the relevant documentation page.
* Implemented the default zoom key for the palette and tile viewers.
* In the tilemap viewer, if the view is in default expand to fit mode,
  zoom in/out starting from the actual zoom ratio.  Once again, this
  behaves more like the zoom controls in a web browser displaying an
  image so it should be more intuitive.
* Made more messages from the tilemap viewer localisable.

-util/zippath.cpp: Fixed MT08074.

* There were multiple issues at play here.  After #8443 was applied,
  is_root was simply never returning true on Windows, as OSD_WINDOWS
  isn't actually defined outside libosd and libocore.  This caused
  phantom parent items to appear in disk roots on Windows, but it meant
  that the check in zippath_resolve would always fail so the trailing
  backslash would be trimmed.  Fixing the macro test in is_root meant
  the trailing backslash from C:\ would no longer be trimmed, which
  caused the stat in zippath_resolve to fail.

-bigbord2.cpp: Hooked up floppy DRQ that had somehow got lost.

-Reduced tag map lookups in several drivers and devices.

-util/coretmpl.h: Removed an overload of bitswap that can be avoided
 using if constexpr.

-Added doxygen comments to some classes, and fixed several doxygen
 warnings.

-util, osd: Test for _WIN32 rather than WIN32.

* In C++17 mode, WIN32 is no longer a predefined macro, although various
  things in 3rdparty define it to maintain legacy support.  We're better
  off moving forward anyway for when WIN32 disappears entirely.  (WIN32
  is not a reserved name, while _WIN32 is, starting with an underscore
  follwed by an uppercase letter.)
2021-09-06 06:34:42 +10:00
Vas Crabb
e8bbea1fc6
formats, osd, util: Started refactoring file I/O stuff. (#8456)
Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic.  Also replaced core_file's build-in zlib compression with a filter.

unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename.

Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums.

Allow mounting TI-99 RPK from inside archives.
2021-08-22 09:06:15 +10:00
Davide Cavalca
4dcb18e015
chdman: add a few more hard disk templates (#8352) 2021-07-30 22:05:56 -04:00
AJR
bc0146c203 Eliminate ARRAY_LENGTH template in favor of C++17's std::size
* osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h

* sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration

* gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset

* emucore.h: Remove obsolete typedef
2021-02-14 11:05:57 -05:00
Vas Crabb
7cfe419ca8 -osd/windows: Minimise full-screen windows on losing focus (#2997).
-osd/modules/osdwindow.cpp: Clean up window title formatting.
 * Show data type model in window title.
 * Moved window title formatting to a single place.

-tools/chdman.cpp: Removed some unnecessary .c_str() calls.
2021-01-21 23:33:53 +11:00
AJR
91921618c2 Much more core std::string_view modernization
- Remove corestr.h from emu.h; update a few source files to not use it at all
- Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type
- Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string
- Remove the string-modifying version of zippath_parent
- Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char *
- Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only
- Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this)
- Change output_manager to use std::string_view for output name arguments
- Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now)
- Change miscellaneous other functions to accept std::string_view arguments
- Remove a few string accessor macros from romload.h
- Remove many unnecessary c_str() calls from logging/error messages
2021-01-20 18:06:15 -05:00
AJR
60e518cc50 Low-level #include overhaul
- vecstream.h: Revert changes made in aa29519528. The std::string_view conversion has been made a non-member function (util::buf_to_string_view) and moved to coretmpl.h.
- strformat.h: Remove the using declaration importing util::string_format into the global namespace. It has been moved to emucore.h and a few tool sources; other references have been qualified.
- osdcore.h: Split out file, directory and path classes and methods to a new header (osdfile.h), Doxygenizing the documentation comments.
- Disaggregate many #includes that were including other standard or custom headers. emu.h now includes basically the same things that it did, but other headers have been streamlined; for instance, emucore.h no longer stealth-includes osdcore.h several ways.
2021-01-02 15:18:15 -05:00
nhand42
ccacd0f165
support Redump extended bin/cue format for Dreamcast discs (#7422)
* initial check-in of Redump bin/cue support for Dreamcast GDI

* correctly identifies multi-cue format and sets GDROM flags

* creates a working Crazy Taxi chd from a Redump bin/cue

* disabled debugging code and started tidying up

* simple tool to compare chdman bin/cue and bin/gdi conversions, should be identical

* final tidy up, the testing is going well

* testing failed for Aero Dancing i (Japan), didnt zero last track

* added some comments about .gdi compatibility

* addressing review feedback on pull request #7422

* match TOSEC layout for Pattern I discs (3 tracks)

* initial support for Pattern III discs

* Pattern III discs now work and match TOSEC layout

* reading datasize from wrong track, same result though

* identify the GDI pattern, makes the code clearer

* support for Pattern II and consecutive AUDIO tracks

* use C99 type not POSIX type to build on Windows

* support Redump tracks split across two .bin files
2020-12-17 18:48:47 +02:00
Vas Crabb
a1d35e5abf Cleaned up bitmap API.
Made const-qualified pixel accessors (pix, pixt, raw_pixptr) return
const-qualified references/pointers to pixesl, and added non-const
versions.  This makes bitmap more like standard library containers where
const protects the content as well as the dimensions.

Made the templated pixt accessor protected - having it public makes it
too easy to inadvertently get a pointer to the wrong location.

Removed the pix(8|16|32|64) accessors from the specific bitmaps.  You
could only use the "correct" one anyway, and having the "incorrect" ones
available prevented explicit instantiations of the class template
because the static assertions would fail.  You can still see the pixel
type in the bitmap class names, and you can't assign the result of
&pix(y, x) to the wrong kind of pointer without a cast.

Added fill member functions to the specific bitmap template, and added
a explicit instantiations.  This allows the bitmap size check to be
skipped on most bitmap fills, although the clipping check is still
there.  Also fixed a couple of places that were trying to fill an
indexed 16-bit bitmap with rgb_t::black() exposed by this (replaced with
zero to get the same net effect).  The explicit template instantiations
in the .cpp file mean the compiler can inline the function if necessary,
but don't need to generate a local out-of-line body if it chooses not
to.

Extended the size of the fill value parameter in the base bitmap class
to 64 bits so it works correctly for 64-bit bitmaps.

Fixed places where IE15 and VGM visualiser weren't accounting for row
bytes potentially being larger than width.

Fixed an off-by-one in an HP-DIO card where it was treating the Topcat
cursor right edge as exclusive.

Updated everything to work with the API changes, reduced the scope of
many variables, added more const, and replaced a few fill/copy loops
with stuff from <algorithm>.
2020-09-27 14:00:42 +10:00
Vas Crabb
a8c6add452 chdman.cpp: GCC 9.3 is actually the cutoff point for legacy MSVC-style long long format flags. 2020-08-23 10:22:24 +10:00
Vas Crabb
5d4b8530d1 looks like I64 size qualifier is only needed for MSYS64 GCC 9 and earlier (nw) 2020-06-02 19:18:20 +10:00
Vas Crabb
35c4696295 chdman: support characters outside ASCII in command line arguments 2020-05-29 19:18:08 +10:00
Vas Crabb
2add7c158c split was using sha1.h directly - fix that (nw) 2020-04-13 06:48:15 +10:00
firewave
399515c7a7 use C++ library includes (nw) 2020-01-22 13:31:52 +01:00
AJR
51f4699fda chdman.cpp: Attempted fix for naive code (nw) 2019-09-06 18:16:36 -04:00
AJR
a748d19a91 chdman.cpp: Another superfluous temporary removed (nw) 2019-09-06 12:04:53 -04:00
AJR
969363be85 chdman: Clean up some archaic string code (nw) 2019-09-06 12:02:42 -04:00
Vas Crabb
97b6717027 (nw) Clean up the mess on master
This effectively reverts b380514764 and
c24473ddff, restoring the state at
598cd52272.

Before pushing, please check that what you're about to push is sane.
Check your local commit log and ensure there isn't anything out-of-place
before pushing to mainline.  When things like this happen, it wastes
everyone's time.  I really don't need this in a week when real work™ is
busting my balls and I'm behind where I want to be with preparing for
MAME release.
2019-03-26 11:13:37 +11:00
andreasnaive
b380514764 Revert "conflict resolution (nw)"
This reverts commit c24473ddff, reversing
changes made to 009cba4fb8.
2019-03-25 23:13:40 +01:00
MetalliC
9d515e5f41 chdman: fix GDI 2048 extraction 2019-01-25 06:10:43 +02:00
Miodrag Milanovic
9be358832d Fix tools as well (nw) 2017-05-15 19:40:12 +02:00
Dirk Best
c6043bac17 chdman: Add support for hard disk templates and add some initial ones 2017-01-07 23:52:55 +01:00
Jordi Mallach
94220aa08b Misc typo fixes. 2016-10-27 13:45:15 +02:00
Miodrag Milanovic
ddb290d5f6 NOTICE (TYPE NAME CONSOLIDATION)
Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8
also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
2016-10-22 13:13:17 +02:00
Miodrag Milanovic
d2e8f61149 dynamic_buffer is just std::vector<UINT8> (nw) 2016-10-21 12:35:05 +02:00
smf-
6623638c3b Fix chdman addmeta --valuefile by calling the correct write_metadata. [smf] 2016-10-09 22:40:42 +01:00
Vas Crabb
05444e3c00 unbreak large files in chdman after refactor 2016-08-01 00:17:52 +10:00
Miodrag Milanovic
9667c6a8cc std::min and std:max instead of MIN and MAX, also some more macros converted to inline functions (nw) 2016-07-31 14:41:02 +02:00
MetalliC
2cf35d78d8 chdman: fix remaining createcd 64bit issues 2016-07-24 17:01:18 +03:00
Miodrag Milanovic
0a95a35f0d compile fix (nw) 2016-07-23 19:14:45 +02:00
Miodrag Milanovic
38e8953add try one old good fix (nw) 2016-07-23 18:48:41 +02:00
Miodrag Milanovic
17080e6959 Revert "fix building with gcc 6.1.0 by making it consistent with other source files. (nw)"
This reverts commit 4423c242a6.
2016-07-23 18:47:39 +02:00
smf-
4423c242a6 fix building with gcc 6.1.0 by making it consistent with other source files. (nw) 2016-07-23 16:18:34 +01:00
Nathan Woods
130e05cc4e Fixed stupid compilation error 2016-07-11 08:26:49 -04:00
Nathan Woods
96066caca0 Removed some c_str() calls that are no longer necessary 2016-07-11 07:24:02 -04:00
Miodrag Milanovic
1d0e0ac12a remove all usages of tagmap 2016-06-18 15:32:15 +02:00
smf-
76430f9bc8 ever since f0823886a6 the guess_chs() function adds dummy sectors to the image until it finds a valid CHS mapping, therefore the error can never be triggered (there is no exit condition on the outer loop) (nw) 2016-06-08 17:47:44 +01:00
smf-
f360cfe384 Ignore cylinders, heads and sectors from identify device data, based on the ATA 5 specification. [smf] 2016-06-02 10:38:48 +01:00
Vas Crabb
6b9c752850 misc fixes (nw)
* fix a mismatched new[]/delete error in corealloc
* _name massacre in corealloc while at it
* add template/macro for delaring array with equivalent dimensions
2016-05-28 15:10:28 +10:00
MetalliC
16d0839f76 chdman: ignore ATA ident CHS values for > 8GB images
minor docs update
2016-05-25 17:57:31 +03:00
Ivan Vangelista
00fd6ba0bd chdman.cpp: fix for code that expects to be able to dereference a pointer that it knows may be null (Vas Crabb) 2016-04-27 10:27:46 +02:00
MetalliC
677cfa86fd fix chdman extractcd track names (was foo.cue.bin instead of foo.bin) 2016-03-30 17:56:19 +03:00
Vas Crabb
100fa28671 * Remove confusing method from vectorstreams that hide base_ios method (fixes disassembly view)
* Allow std::string to pass through core_file unmolested (reduces temporary allocations)
* Make zip/7z instances of same class with uniform interface
* zippath browsing is broken at the moment

This is another step towards transparent archive support.  It's now
possible to access zip and 7z archives with the same code.  Nothing is
taking advantage of it yet.  There's now some very similar code in
fileio.cpp and clifront.cpp that could be folded at some point.
2016-03-18 19:32:10 +11:00
Brandon Munger
7a3a46e477 Fix chdman again for I64FMT on WIN32 2016-03-14 13:22:49 -04:00
Brandon Munger
33da5e88a0 chdman I64FMT fix for OSX, FreeBSD 2016-03-14 13:11:41 -04:00
Brandon Munger
63e253e2c5 Fix I64FMT in chdman for Linux 64 bit 2016-03-14 12:55:08 -04:00
Vas Crabb
42fbb9c396 Make osd_file a polymorphic class that's held with smart pointers
Make avi_file a class that's held with smart pointers, encapsulate various AVI I/O structures
Make zip_file and _7z_file classes rather than having free functions everywhere
Hide zip/7z class implementation behind an interface, no longer need to call close() to send back to the cache
Don't dump as much crap in global namespace
Add solaris PTY implementation
Improve variable expansion for SDL OSD - supports ~/$FOO/${BAR} syntax
Rearrange stuff so the same things are in file module for all OSDs
Move file stuff into its own module

7z/zip open and destruct are still not thread-safe due to lack of interlocks around cache access
Directory functions still need to be moved to file module
SDL OSD may not initialise WinSock on Windows
2016-03-14 18:55:00 +11:00