From f661970a4a93a96b3249da4cf440c6d98f90bda0 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 21 Oct 2010 16:14:46 +0000 Subject: [PATCH] Make osdmini build again. --- .gitattributes | 1 + src/osd/osdmini/minifile.c | 53 +++++++++++++++++++++ src/osd/osdmini/minimain.c | 34 ++++++++++--- src/osd/osdmini/minimisc.c | 15 +++++- src/osd/osdmini/miniwork.c | 3 +- src/osd/osdmini/osdmini.h | 98 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 195 insertions(+), 9 deletions(-) create mode 100644 src/osd/osdmini/osdmini.h diff --git a/.gitattributes b/.gitattributes index 65aa258e7c5..d3c3be77423 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4196,6 +4196,7 @@ src/osd/osdmini/minimisc.c svneol=native#text/plain src/osd/osdmini/minisync.c svneol=native#text/plain src/osd/osdmini/minitime.c svneol=native#text/plain src/osd/osdmini/miniwork.c svneol=native#text/plain +src/osd/osdmini/osdmini.h svneol=native#text/plain src/osd/osdmini/osdmini.mak svneol=native#text/plain src/osd/sdl/README_SDL13.txt svneol=native#text/plain src/osd/sdl/SDL1211_opengl.h svneol=native#text/plain diff --git a/src/osd/osdmini/minifile.c b/src/osd/osdmini/minifile.c index b3c16c4cf0f..53836f0807d 100644 --- a/src/osd/osdmini/minifile.c +++ b/src/osd/osdmini/minifile.c @@ -40,6 +40,7 @@ //============================================================ #include "osdcore.h" +#include //============================================================ @@ -165,3 +166,55 @@ int osd_uchar_from_osdchar(UINT32 /* unicode_char */ *uchar, const char *osdchar *uchar = (UINT8)*osdchar; return 1; } + + +//============================================================ +// osd_stat +//============================================================ + +osd_directory_entry *osd_stat(const char *path) +{ + osd_directory_entry *result = NULL; + + // create an osd_directory_entry; be sure to make sure that the caller can + // free all resources by just freeing the resulting osd_directory_entry + result = (osd_directory_entry *)malloc(sizeof(*result) + strlen(path) + 1); + strcpy((char *)(result + 1), path); + result->name = (char *)(result + 1); + result->type = ENTTYPE_NONE; + result->size = 0; + + FILE *f = fopen(path, "rb"); + if (f != NULL) + { + fseek(f, 0, SEEK_END); + result->type = ENTTYPE_FILE; + result->size = ftell(f); + fclose(f); + } + return result; +} + + +//============================================================ +// osd_get_full_path +//============================================================ + +file_error osd_get_full_path(char **dst, const char *path) +{ + // derive the full path of the file in an allocated string + // for now just fake it since we don't presume any underlying file system + *dst = strdup(path); + return FILERR_NONE; +} + + +//============================================================ +// osd_get_volume_name +//============================================================ + +const char *osd_get_volume_name(int idx) +{ + // we don't expose volumes + return NULL; +} diff --git a/src/osd/osdmini/minimain.c b/src/osd/osdmini/minimain.c index af92a78e197..326d18f21fb 100644 --- a/src/osd/osdmini/minimain.c +++ b/src/osd/osdmini/minimain.c @@ -43,6 +43,7 @@ #include "osdepend.h" #include "render.h" #include "clifront.h" +#include "osdmini.h" //============================================================ @@ -94,7 +95,26 @@ int main(int argc, char *argv[]) { // cli_execute does the heavy lifting; if we have osd-specific options, we // would pass them as the third parameter here - return cli_execute(argc, argv, NULL); + mini_osd_interface osd; + return cli_execute(argc, argv, osd, NULL); +} + + +//============================================================ +// constructor +//============================================================ + +mini_osd_interface::mini_osd_interface() +{ +} + + +//============================================================ +// destructor +//============================================================ + +mini_osd_interface::~mini_osd_interface() +{ } @@ -147,20 +167,20 @@ void mini_osd_interface::update(bool skip_redraw) our_target->compute_minimum_size(minwidth, minheight); // make that the size of our target - our_target->render_target_set_bounds(minwidth, minheight); + our_target->set_bounds(minwidth, minheight); // get the list of primitives for the target at the current size - const render_primitive_list *primlist = our_target->get_primitives(); + render_primitive_list &primlist = our_target->get_primitives(); // lock them, and then render them - primlist->acquire_locK(); + primlist.acquire_lock(); // do the drawing here - primlist->release_lock(); + primlist.release_lock(); // after 5 seconds, exit - if (attotime_compare(timer_get_time(machine), attotime_make(5, 0)) > 0) - machine->schedule_exit(); + if (attotime_compare(timer_get_time(&machine()), attotime_make(5, 0)) > 0) + machine().schedule_exit(); } diff --git a/src/osd/osdmini/minimisc.c b/src/osd/osdmini/minimisc.c index 8faae218544..8d040b28e0e 100644 --- a/src/osd/osdmini/minimisc.c +++ b/src/osd/osdmini/minimisc.c @@ -40,13 +40,14 @@ //============================================================ #include "osdcore.h" +#include //============================================================ // osd_alloc //============================================================ -void *osd_alloc(size_t size) +void *osd_malloc(size_t size) { return malloc(size); } @@ -92,3 +93,15 @@ void osd_break_into_debugger(const char *message) { // there is no standard way to do this, so ignore it } + + +//============================================================ +// osd_get_clipboard_text +//============================================================ + +char *osd_get_clipboard_text(void) +{ + // can't support clipboards generically + return NULL; +} + diff --git a/src/osd/osdmini/miniwork.c b/src/osd/osdmini/miniwork.c index 35d73d1038e..911d145f17b 100644 --- a/src/osd/osdmini/miniwork.c +++ b/src/osd/osdmini/miniwork.c @@ -40,6 +40,7 @@ //============================================================ #include "osdcore.h" +#include //============================================================ @@ -107,7 +108,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call int itemnum; // allocate memory to hold the result - item = malloc(sizeof(*item)); + item = (osd_work_item *)malloc(sizeof(*item)); if (item == NULL) return NULL; diff --git a/src/osd/osdmini/osdmini.h b/src/osd/osdmini/osdmini.h new file mode 100644 index 00000000000..aee9cd2ac64 --- /dev/null +++ b/src/osd/osdmini/osdmini.h @@ -0,0 +1,98 @@ +//============================================================ +// +// osdmini.h - Core header +// +//============================================================ +// +// Copyright Aaron Giles +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or +// without modification, are permitted provided that the +// following conditions are met: +// +// * Redistributions of source code must retain the above +// copyright notice, this list of conditions and the +// following disclaimer. +// * Redistributions in binary form must reproduce the +// above copyright notice, this list of conditions and +// the following disclaimer in the documentation and/or +// other materials provided with the distribution. +// * Neither the name 'MAME' nor the names of its +// contributors may be used to endorse or promote +// products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGE (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +//============================================================ + +#include "options.h" +#include "osdepend.h" + + +//============================================================ +// TYPE DEFINITIONS +//============================================================ + +class mini_osd_interface : public osd_interface +{ +public: + // construction/destruction + mini_osd_interface(); + virtual ~mini_osd_interface(); + + // general overridables + virtual void init(running_machine &machine); + virtual void update(bool skip_redraw); + + // debugger overridables +// virtual void init_debugger(); +// virtual void wait_for_debugger(device_t &device, bool firststop); + + // audio overridables + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame); + virtual void set_mastervolume(int attenuation); + + // input overridables + virtual void customize_input_type_list(input_type_desc *typelist); + +private: + static void osd_exit(running_machine &machine); +}; + + + +//============================================================ +// GLOBAL VARIABLES +//============================================================ + +extern const options_entry mame_win_options[]; + +// defined in winwork.c +extern int osd_num_processors; + + + +//============================================================ +// FUNCTION PROTOTYPES +//============================================================ + +// use if you want to print something with the verbose flag +void CLIB_DECL mame_printf_verbose(const char *text, ...) ATTR_PRINTF(1,2); + +// use this to ping the watchdog +void winmain_watchdog_ping(void); +void winmain_dump_stack();