mirror of
https://github.com/libretro/mame2003-plus-libretro.git
synced 2024-12-03 14:50:48 +00:00
Merge pull request #348 from markwkidd/restore_xml_generator
xml gamelist generator via MAME tab menu
This commit is contained in:
commit
b0e3c64cf6
6
Makefile
6
Makefile
@ -202,7 +202,7 @@ else ifeq ($(platform), wiiu)
|
||||
else ifeq ($(platform), switch)
|
||||
EXT=a
|
||||
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
|
||||
PLATCFLAGS += -Dstricmp=strcasecmp
|
||||
PLATCFLAGS += -Dstricmp=strcasecmp -D__SWITCH__
|
||||
include $(LIBTRANSISTOR_HOME)/libtransistor.mk
|
||||
STATIC_LINKING=1
|
||||
|
||||
@ -272,7 +272,7 @@ else ifeq ($(platform), gcw0)
|
||||
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
|
||||
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
|
||||
LDFLAGS += -shared -Wl,--version-script=link.T -Wl,-no-undefined
|
||||
PLATCFLAGS += -Dstricmp=strcasecmp
|
||||
PLATCFLAGS += -Dstricmp=strcasecmp -D__GCW0__
|
||||
LIBS := -lc -lgcc
|
||||
fpic := -fPIC -nostdlib
|
||||
LIBS =
|
||||
@ -282,7 +282,7 @@ else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
|
||||
HAVE_RZLIB := 1
|
||||
STATIC_LINKING := 1
|
||||
PLATCFLAGS += -Dstricmp=strcasecmp
|
||||
PLATCFLAGS += -Dstricmp=strcasecmp -D__EMSCRIPTEN__
|
||||
|
||||
# Windows MSVC 2003 Xbox 1
|
||||
else ifeq ($(platform), xbox1_msvc2003)
|
||||
|
12
src/fileio.c
12
src/fileio.c
@ -106,9 +106,6 @@ mame_file *mame_fopen(const char *gamename, const char *filename, int filetype,
|
||||
case FILETYPE_ARTWORK:
|
||||
case FILETYPE_HISTORY:
|
||||
case FILETYPE_LANGUAGE:
|
||||
#ifndef MESS
|
||||
case FILETYPE_INI:
|
||||
#endif
|
||||
if (openforwrite)
|
||||
{
|
||||
logerror("mame_fopen: type %02x write not supported\n", filetype);
|
||||
@ -220,14 +217,6 @@ mame_file *mame_fopen(const char *gamename, const char *filename, int filetype,
|
||||
case FILETYPE_CTRLR:
|
||||
return generic_fopen(filetype, gamename, filename, 0, openforwrite ? FILEFLAG_OPENWRITE : FILEFLAG_OPENREAD);
|
||||
|
||||
/* game specific ini files */
|
||||
case FILETYPE_INI:
|
||||
#ifndef MESS
|
||||
return generic_fopen(filetype, NULL, gamename, 0, FILEFLAG_OPENREAD);
|
||||
#else
|
||||
return generic_fopen(filetype, NULL, gamename, 0, openforwrite ? FILEFLAG_OPENWRITE : FILEFLAG_OPENREAD);
|
||||
#endif
|
||||
|
||||
#ifdef MESS
|
||||
/* CRC files */
|
||||
case FILETYPE_CRC:
|
||||
@ -824,7 +813,6 @@ static const char *get_extension_for_filetype(int filetype)
|
||||
break;
|
||||
|
||||
case FILETYPE_CTRLR: /* config files */
|
||||
case FILETYPE_INI: /* game specific ini files */
|
||||
extension = "ini";
|
||||
break;
|
||||
|
||||
|
@ -38,10 +38,10 @@ enum
|
||||
FILETYPE_CHEAT,
|
||||
FILETYPE_LANGUAGE,
|
||||
FILETYPE_CTRLR,
|
||||
FILETYPE_INI,
|
||||
#ifdef MESS
|
||||
FILETYPE_CRC,
|
||||
#endif
|
||||
FILETYPE_XML_DAT,
|
||||
FILETYPE_end /* dummy last entry */
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "info.h"
|
||||
#include "hash.h"
|
||||
#include "datafile.h"
|
||||
#include "fileio.h"
|
||||
|
||||
/* Format */
|
||||
#define SELECT(a,b) (OUTPUT_XML ? (b) : (a))
|
||||
@ -815,6 +816,8 @@ static void print_game_driver(int OUTPUT_XML, FILE* out, const struct GameDriver
|
||||
fprintf(out, SELECT(L1P "driver" L2B, "\t\t<driver"));
|
||||
if (game->flags & GAME_NOT_WORKING)
|
||||
fprintf(out, SELECT(L2P "status preliminary" L2N, " status=\"preliminary\""));
|
||||
else if (game->flags & GAME_UNEMULATED_PROTECTION)
|
||||
fprintf(out, SELECT(L2P "protection" L2N, " status=\"protection\""));
|
||||
else
|
||||
fprintf(out, SELECT(L2P "status good" L2N, " status=\"good\""));
|
||||
|
||||
|
@ -157,7 +157,7 @@ void osd_sound_enable(int enable)
|
||||
File I/O
|
||||
|
||||
******************************************************************************/
|
||||
static const char* const paths[] = { "raw", "rom", "image", "diff", "samples", "artwork", "nvram", "hi", "hsdb", "cfg", "inp", "memcard", "snap", "history", "cheat", "lang", "ctrlr", "ini" };
|
||||
static const char* const paths[] = { "raw", "rom", "image", "diff", "samples", "artwork", "nvram", "hi", "hsdb", "cfg", "inp", "memcard", "snap", "history", "cheat", "lang", "ctrlr" };
|
||||
|
||||
struct _osd_file
|
||||
{
|
||||
@ -177,9 +177,8 @@ int osd_get_path_info(int pathtype, int pathindex, const char *filename)
|
||||
|
||||
switch (pathtype)
|
||||
{
|
||||
case FILETYPE_ROM: /* ROM */
|
||||
case FILETYPE_ROM:
|
||||
case FILETYPE_IMAGE:
|
||||
/* removes the stupid restriction where we need to have roms in a 'rom' folder */
|
||||
strcpy(currDir, romDir);
|
||||
break;
|
||||
case FILETYPE_IMAGE_DIFF:
|
||||
@ -189,18 +188,12 @@ int osd_get_path_info(int pathtype, int pathindex, const char *filename)
|
||||
case FILETYPE_INPUTLOG:
|
||||
case FILETYPE_MEMCARD:
|
||||
case FILETYPE_SCREENSHOT:
|
||||
/* user generated content goes in Retroarch save directory */
|
||||
/* user generated content goes in mam2003 save directory subfolders */
|
||||
snprintf(currDir, 1024, "%s%c%s%c%s", saveDir, slash, parentDir, slash, paths[pathtype]);
|
||||
break;
|
||||
case FILETYPE_HIGHSCORE_DB:
|
||||
case FILETYPE_HISTORY:
|
||||
case FILETYPE_CHEAT:
|
||||
/* .dat files go directly in the Retroarch system directory */
|
||||
snprintf(currDir, 1024, "%s%c%s", systemDir, slash, parentDir);
|
||||
break;
|
||||
default:
|
||||
/* additonal core content goes in Retroarch system directory */
|
||||
snprintf(currDir, 1024, "%s%c%s%c%s", systemDir, slash, parentDir, slash, paths[pathtype]);
|
||||
/* .dat files and additional core content goes in mame2003 system directory */
|
||||
snprintf(currDir, 1024, "%s%c%s", systemDir, slash, parentDir);
|
||||
}
|
||||
|
||||
snprintf(buffer, 1024, "%s%c%s", currDir, slash, filename);
|
||||
@ -223,30 +216,23 @@ osd_file *osd_fopen(int pathtype, int pathindex, const char *filename, const cha
|
||||
|
||||
switch (pathtype)
|
||||
{
|
||||
case 1: /* ROM */
|
||||
case 2: /* IMAGE */
|
||||
/* removes the stupid restriction where we need to have roms in a 'rom' folder */
|
||||
case FILETYPE_ROM:
|
||||
case FILETYPE_IMAGE:
|
||||
strcpy(currDir, romDir);
|
||||
break;
|
||||
case 3: /* IMAGE DIFF */
|
||||
case 6: /* NVRAM */
|
||||
case 7: /* HIGHSCORE */
|
||||
case 9: /* CONFIG */
|
||||
case 10: /* INPUT LOG */
|
||||
case 11: /* MEMORY CARD */
|
||||
case 12: /* SCREENSHOT */
|
||||
/* user generated content goes in Retroarch save directory */
|
||||
case FILETYPE_IMAGE_DIFF:
|
||||
case FILETYPE_NVRAM:
|
||||
case FILETYPE_HIGHSCORE:
|
||||
case FILETYPE_CONFIG:
|
||||
case FILETYPE_INPUTLOG:
|
||||
case FILETYPE_MEMCARD:
|
||||
case FILETYPE_SCREENSHOT:
|
||||
/* user generated content goes in mam2003 save directory subfolders */
|
||||
snprintf(currDir, 1024, "%s%c%s%c%s", saveDir, slash, parentDir, slash, paths[pathtype]);
|
||||
break;
|
||||
case 8: /* HIGHSCORE DB */
|
||||
case 13: /* HISTORY */
|
||||
case 14: /* CHEAT */
|
||||
/* .dat files go directly in the Retroarch system directory */
|
||||
snprintf(currDir, 1024, "%s%c%s", systemDir, slash, parentDir);
|
||||
break;
|
||||
default:
|
||||
/* additonal core content goes in Retroarch system directory */
|
||||
snprintf(currDir, 1024, "%s%c%s%c%s", systemDir, slash, parentDir, slash, paths[pathtype]);
|
||||
/* .dat files and additional core content goes in mame2003 system directory */
|
||||
snprintf(currDir, 1024, "%s%c%s", systemDir, slash, parentDir);
|
||||
}
|
||||
|
||||
snprintf(buffer, 1024, "%s%c%s", currDir, slash, filename);
|
||||
|
@ -341,6 +341,7 @@ void run_game_done(void)
|
||||
|
||||
static int init_machine(void)
|
||||
{
|
||||
|
||||
/* load the localization file */
|
||||
if (uistring_init(options.language_file) != 0)
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ static const char *mame_default_text[] =
|
||||
"Game Information",
|
||||
"Game History",
|
||||
"Reset Game",
|
||||
"Generate XML DAT",
|
||||
"Return to Game",
|
||||
"Cheat",
|
||||
"Memory Card",
|
||||
|
@ -84,6 +84,7 @@ enum
|
||||
UI_gameinfo,
|
||||
UI_history,
|
||||
UI_resetgame,
|
||||
UI_generate_xml_dat,
|
||||
UI_returntogame,
|
||||
UI_cheat,
|
||||
UI_memorycard,
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include "ui_text.h"
|
||||
#include "fileio.h"
|
||||
#include "libretro.h"
|
||||
|
||||
#ifdef MESS
|
||||
#include "mess.h"
|
||||
@ -30,7 +32,7 @@ static struct mame_bitmap *pause_bitmap;
|
||||
static char pause_buffer[2048];
|
||||
static int pause_done;
|
||||
|
||||
|
||||
extern retro_log_printf_t log_cb;
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -3023,11 +3025,11 @@ int memcard_menu(struct mame_bitmap *bitmap, int selection)
|
||||
#ifndef MESS
|
||||
enum { UI_SWITCH = 0,UI_DEFCODE,UI_CODE,UI_ANALOG,UI_CALIBRATE,
|
||||
UI_STATS,UI_GAMEINFO, UI_HISTORY,
|
||||
UI_CHEAT,UI_RESET,UI_MEMCARD,UI_RAPIDFIRE,UI_EXIT };
|
||||
UI_CHEAT,UI_RESET,UI_GENERATE_XML_DAT, UI_MEMCARD,UI_RAPIDFIRE,UI_EXIT };
|
||||
#else
|
||||
enum { UI_SWITCH = 0,UI_DEFCODE,UI_CODE,UI_ANALOG,UI_CALIBRATE,
|
||||
UI_GAMEINFO, UI_IMAGEINFO,UI_FILEMANAGER,UI_TAPECONTROL,
|
||||
UI_HISTORY,UI_CHEAT,UI_RESET,UI_MEMCARD,UI_RAPIDFIRE,UI_EXIT,
|
||||
UI_HISTORY,UI_CHEAT,UI_RESET,UI_GENERATE_XML_DAT,UI_MEMCARD,UI_RAPIDFIRE,UI_EXIT,
|
||||
UI_CONFIGURATION };
|
||||
#endif
|
||||
|
||||
@ -3149,6 +3151,10 @@ static void setup_menu_init(void)
|
||||
#endif
|
||||
|
||||
menu_item[menu_total] = ui_getstring (UI_resetgame); menu_action[menu_total++] = UI_RESET;
|
||||
#if !defined(WIIU) && !defined(GEKKO) && !defined(__CELLOS_LV2__) && !defined(__SWITCH__) && !defined(PSP) && !defined(VITA) && !defined(__GCW0__) && !defined(__EMSCRIPTEN__) && !defined(_XBOX)
|
||||
/* don't offer to generate_xml_dat on consoles where it can't be used */
|
||||
menu_item[menu_total] = ui_getstring (UI_generate_xml_dat); menu_action[menu_total++] = UI_GENERATE_XML_DAT;
|
||||
#endif
|
||||
menu_item[menu_total] = ui_getstring (UI_returntogame); menu_action[menu_total++] = UI_EXIT;
|
||||
menu_item[menu_total] = 0; /* terminate array */
|
||||
}
|
||||
@ -3283,6 +3289,10 @@ static int setup_menu(struct mame_bitmap *bitmap, int selected)
|
||||
case UI_RESET:
|
||||
machine_reset();
|
||||
break;
|
||||
|
||||
case UI_GENERATE_XML_DAT:
|
||||
generate_xml_dat();
|
||||
break;
|
||||
|
||||
case UI_EXIT:
|
||||
menu_lastselected = 0;
|
||||
@ -3306,6 +3316,28 @@ static int setup_menu(struct mame_bitmap *bitmap, int selected)
|
||||
return sel + 1;
|
||||
}
|
||||
|
||||
struct _osd_file
|
||||
{
|
||||
FILE* file;
|
||||
};
|
||||
|
||||
void generate_xml_dat()
|
||||
{
|
||||
osd_file *xml_dat_osd;
|
||||
|
||||
int pathcount = osd_get_path_count(FILETYPE_XML_DAT);
|
||||
xml_dat_osd = osd_fopen(FILETYPE_XML_DAT, pathcount, "mame2003.xml", "w+b");
|
||||
|
||||
FILE *xml_dat = xml_dat_osd->file;
|
||||
if (xml_dat != NULL)
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "Generating mame2003.xml\n");
|
||||
print_mame_xml(xml_dat, drivers);
|
||||
osd_fclose(xml_dat_osd);
|
||||
} else {
|
||||
log_cb(RETRO_LOG_WARN, "Unable to open mame2003.xml for writing.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -45,6 +45,8 @@ void set_ui_visarea (int xmin, int ymin, int xmax, int ymax);
|
||||
void init_user_interface(void);
|
||||
int handle_user_interface(struct mame_bitmap *bitmap);
|
||||
|
||||
void generate_xml_dat(void);
|
||||
|
||||
int onscrd_active(void);
|
||||
int setup_active(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user