This commit is contained in:
aliaspider 2014-11-20 09:36:30 +01:00
parent af3bd998e2
commit 1215ef5229
7 changed files with 245 additions and 669 deletions

View File

@ -225,10 +225,6 @@ OBJECTS += $(CORE_DIR)/blip/Blip_Buffer.o
OBJECTS += libretro.o
OBJECTS += scrc32.o
FLAGS += -DNEED_TREMOR
FLAGS += -DWANT_CRC32
ifeq ($(NO_GCC),1)
EXTRA_GCC_FLAGS :=
else
@ -247,7 +243,7 @@ endif
all: $(TARGET)
ifeq ($(DEBUG),1)
FLAGS += -O0 -g
FLAGS += -O0 -g -DDEBUG
else
FLAGS += -O3 -g -DNDEBUG
endif
@ -256,9 +252,9 @@ LDFLAGS += $(fpic) $(SHARED)
FLAGS += $(fpic) $(EXTRA_GCC_FLAGS)
FLAGS += -I. -I$(CORE_DIR) -I$(MEDNAFEN_DIR)
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.31\" -DPACKAGE=\"mednafen\"
FLAGS += -DMEDNAFEN_VERSION_NUMERIC=931 -DPSS_STYLE=1 -DMPC_FIXED_POINT -DSTDC_HEADERS -D__STDC_LIMIT_MACROS
FLAGS += -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES)
FLAGS += $(ENDIANNESS_DEFINES) $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.31\" -DPACKAGE=\"mednafen\"
FLAGS += -DMEDNAFEN_VERSION_NUMERIC=931
FLAGS += -D__LIBRETRO__ $(EXTRA_INCLUDES)
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
FLAGS += -DFRONTEND_SUPPORTS_RGB565

View File

@ -1060,7 +1060,7 @@ MDFNGI* MDFNI_LoadCD(const char* force_module, const char* devicename)
}
catch (std::exception &e)
{
MDFND_PrintError(e.what());
// MDFND_PrintError(e.what());
MDFN_PrintError(("Error opening CD."));
return (0);
}
@ -1533,8 +1533,6 @@ static uint64_t video_frames, audio_frames;
void retro_run(void)
{
MDFNGI* curgame = (MDFNGI*)game;
input_poll_cb();
update_input();
@ -1568,13 +1566,6 @@ void retro_run(void)
Emulate(&spec);
int16* const SoundBuf = spec.SoundBuf + spec.SoundBufSizeALMS *
curgame->soundchan;
int32 SoundBufSize = spec.SoundBufSize - spec.SoundBufSizeALMS;
const int32 SoundBufMaxSize = spec.SoundBufMaxSize - spec.SoundBufSizeALMS;
spec.SoundBufSize = spec.SoundBufSizeALMS + SoundBufSize;
unsigned width = spec.DisplayRect.w & ~0x1;
unsigned height = spec.DisplayRect.h;
@ -1874,42 +1865,7 @@ std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char* cd1)
return ret;
}
void MDFND_Message(const char* str)
{
if (log_cb)
log_cb(RETRO_LOG_INFO, "%s\n", str);
}
void MDFND_MidSync(const EmulateSpecStruct*)
{}
void MDFN_MidLineUpdate(EmulateSpecStruct* espec, int y)
{
//MDFND_MidLineUpdate(espec, y);
}
void MDFND_PrintError(const char* err)
{
if (log_cb)
log_cb(RETRO_LOG_ERROR, "%s\n", err);
}
/* forward declarations */
extern void MDFND_DispMessage(unsigned char* str);
void MDFND_DispMessage(unsigned char* str)
{
const char* strc = (const char*)str;
struct retro_message msg =
{
strc,
180
};
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &msg);
}
void MDFN_ResetMessages(void)
{
}

View File

@ -1,365 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
This file includes parts(thus is modified from) of SDL_keysym.h, whose file header is shown below:
Everything from VIRTB_KB_UNKNOWN to VIRTB_KB_UNDO should map to SDLK_UNKNOWN to SDLK_KB_UNDO, so the driver
side can use the raw VIRTB_KB_* values for SDLK_* if less than VIRTB_KB_LAST if using SDL 1.2(if not SDL 1.3),
but probably really should have a translation table.
*/
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifndef __MDFN_GIT_VIRTB_H
#define __MDFN_GIT_VIRTB_H
/* What we really want is a mapping of every raw key on the keyboard.
To support international keyboards, we use the range 0xA1 - 0xFF
as international virtual keycodes. We'll follow in the footsteps of X11...
The names of the keys
*/
typedef enum {
VIRTB_UNKNOWN = 0,
/* The keyboard syms have been cleverly chosen to map to ASCII */
VIRTB_KB_UNKNOWN = 0,
VIRTB_KB_FIRST = 0,
VIRTB_KB_BACKSPACE = 8,
VIRTB_KB_TAB = 9,
VIRTB_KB_CLEAR = 12,
VIRTB_KB_RETURN = 13,
VIRTB_KB_PAUSE = 19,
VIRTB_KB_ESCAPE = 27,
VIRTB_KB_SPACE = 32,
VIRTB_KB_EXCLAIM = 33,
VIRTB_KB_QUOTEDBL = 34,
VIRTB_KB_HASH = 35,
VIRTB_KB_DOLLAR = 36,
VIRTB_KB_AMPERSAND = 38,
VIRTB_KB_QUOTE = 39,
VIRTB_KB_LEFTPAREN = 40,
VIRTB_KB_RIGHTPAREN = 41,
VIRTB_KB_ASTERISK = 42,
VIRTB_KB_PLUS = 43,
VIRTB_KB_COMMA = 44,
VIRTB_KB_MINUS = 45,
VIRTB_KB_PERIOD = 46,
VIRTB_KB_SLASH = 47,
VIRTB_KB_0 = 48,
VIRTB_KB_1 = 49,
VIRTB_KB_2 = 50,
VIRTB_KB_3 = 51,
VIRTB_KB_4 = 52,
VIRTB_KB_5 = 53,
VIRTB_KB_6 = 54,
VIRTB_KB_7 = 55,
VIRTB_KB_8 = 56,
VIRTB_KB_9 = 57,
VIRTB_KB_COLON = 58,
VIRTB_KB_SEMICOLON = 59,
VIRTB_KB_LESS = 60,
VIRTB_KB_EQUALS = 61,
VIRTB_KB_GREATER = 62,
VIRTB_KB_QUESTION = 63,
VIRTB_KB_AT = 64,
/*
Skip uppercase letters
*/
VIRTB_KB_LEFTBRACKET = 91,
VIRTB_KB_BACKSLASH = 92,
VIRTB_KB_RIGHTBRACKET = 93,
VIRTB_KB_CARET = 94,
VIRTB_KB_UNDERSCORE = 95,
VIRTB_KB_BACKQUOTE = 96,
VIRTB_KB_a = 97,
VIRTB_KB_b = 98,
VIRTB_KB_c = 99,
VIRTB_KB_d = 100,
VIRTB_KB_e = 101,
VIRTB_KB_f = 102,
VIRTB_KB_g = 103,
VIRTB_KB_h = 104,
VIRTB_KB_i = 105,
VIRTB_KB_j = 106,
VIRTB_KB_k = 107,
VIRTB_KB_l = 108,
VIRTB_KB_m = 109,
VIRTB_KB_n = 110,
VIRTB_KB_o = 111,
VIRTB_KB_p = 112,
VIRTB_KB_q = 113,
VIRTB_KB_r = 114,
VIRTB_KB_s = 115,
VIRTB_KB_t = 116,
VIRTB_KB_u = 117,
VIRTB_KB_v = 118,
VIRTB_KB_w = 119,
VIRTB_KB_x = 120,
VIRTB_KB_y = 121,
VIRTB_KB_z = 122,
VIRTB_KB_DELETE = 127,
/* End of ASCII mapped keysyms */
/* International keyboard syms */
VIRTB_KB_WORLD_0 = 160, /* 0xA0 */
VIRTB_KB_WORLD_1 = 161,
VIRTB_KB_WORLD_2 = 162,
VIRTB_KB_WORLD_3 = 163,
VIRTB_KB_WORLD_4 = 164,
VIRTB_KB_WORLD_5 = 165,
VIRTB_KB_WORLD_6 = 166,
VIRTB_KB_WORLD_7 = 167,
VIRTB_KB_WORLD_8 = 168,
VIRTB_KB_WORLD_9 = 169,
VIRTB_KB_WORLD_10 = 170,
VIRTB_KB_WORLD_11 = 171,
VIRTB_KB_WORLD_12 = 172,
VIRTB_KB_WORLD_13 = 173,
VIRTB_KB_WORLD_14 = 174,
VIRTB_KB_WORLD_15 = 175,
VIRTB_KB_WORLD_16 = 176,
VIRTB_KB_WORLD_17 = 177,
VIRTB_KB_WORLD_18 = 178,
VIRTB_KB_WORLD_19 = 179,
VIRTB_KB_WORLD_20 = 180,
VIRTB_KB_WORLD_21 = 181,
VIRTB_KB_WORLD_22 = 182,
VIRTB_KB_WORLD_23 = 183,
VIRTB_KB_WORLD_24 = 184,
VIRTB_KB_WORLD_25 = 185,
VIRTB_KB_WORLD_26 = 186,
VIRTB_KB_WORLD_27 = 187,
VIRTB_KB_WORLD_28 = 188,
VIRTB_KB_WORLD_29 = 189,
VIRTB_KB_WORLD_30 = 190,
VIRTB_KB_WORLD_31 = 191,
VIRTB_KB_WORLD_32 = 192,
VIRTB_KB_WORLD_33 = 193,
VIRTB_KB_WORLD_34 = 194,
VIRTB_KB_WORLD_35 = 195,
VIRTB_KB_WORLD_36 = 196,
VIRTB_KB_WORLD_37 = 197,
VIRTB_KB_WORLD_38 = 198,
VIRTB_KB_WORLD_39 = 199,
VIRTB_KB_WORLD_40 = 200,
VIRTB_KB_WORLD_41 = 201,
VIRTB_KB_WORLD_42 = 202,
VIRTB_KB_WORLD_43 = 203,
VIRTB_KB_WORLD_44 = 204,
VIRTB_KB_WORLD_45 = 205,
VIRTB_KB_WORLD_46 = 206,
VIRTB_KB_WORLD_47 = 207,
VIRTB_KB_WORLD_48 = 208,
VIRTB_KB_WORLD_49 = 209,
VIRTB_KB_WORLD_50 = 210,
VIRTB_KB_WORLD_51 = 211,
VIRTB_KB_WORLD_52 = 212,
VIRTB_KB_WORLD_53 = 213,
VIRTB_KB_WORLD_54 = 214,
VIRTB_KB_WORLD_55 = 215,
VIRTB_KB_WORLD_56 = 216,
VIRTB_KB_WORLD_57 = 217,
VIRTB_KB_WORLD_58 = 218,
VIRTB_KB_WORLD_59 = 219,
VIRTB_KB_WORLD_60 = 220,
VIRTB_KB_WORLD_61 = 221,
VIRTB_KB_WORLD_62 = 222,
VIRTB_KB_WORLD_63 = 223,
VIRTB_KB_WORLD_64 = 224,
VIRTB_KB_WORLD_65 = 225,
VIRTB_KB_WORLD_66 = 226,
VIRTB_KB_WORLD_67 = 227,
VIRTB_KB_WORLD_68 = 228,
VIRTB_KB_WORLD_69 = 229,
VIRTB_KB_WORLD_70 = 230,
VIRTB_KB_WORLD_71 = 231,
VIRTB_KB_WORLD_72 = 232,
VIRTB_KB_WORLD_73 = 233,
VIRTB_KB_WORLD_74 = 234,
VIRTB_KB_WORLD_75 = 235,
VIRTB_KB_WORLD_76 = 236,
VIRTB_KB_WORLD_77 = 237,
VIRTB_KB_WORLD_78 = 238,
VIRTB_KB_WORLD_79 = 239,
VIRTB_KB_WORLD_80 = 240,
VIRTB_KB_WORLD_81 = 241,
VIRTB_KB_WORLD_82 = 242,
VIRTB_KB_WORLD_83 = 243,
VIRTB_KB_WORLD_84 = 244,
VIRTB_KB_WORLD_85 = 245,
VIRTB_KB_WORLD_86 = 246,
VIRTB_KB_WORLD_87 = 247,
VIRTB_KB_WORLD_88 = 248,
VIRTB_KB_WORLD_89 = 249,
VIRTB_KB_WORLD_90 = 250,
VIRTB_KB_WORLD_91 = 251,
VIRTB_KB_WORLD_92 = 252,
VIRTB_KB_WORLD_93 = 253,
VIRTB_KB_WORLD_94 = 254,
VIRTB_KB_WORLD_95 = 255, /* 0xFF */
/* Numeric keypad */
VIRTB_KB_KP0 = 256,
VIRTB_KB_KP1 = 257,
VIRTB_KB_KP2 = 258,
VIRTB_KB_KP3 = 259,
VIRTB_KB_KP4 = 260,
VIRTB_KB_KP5 = 261,
VIRTB_KB_KP6 = 262,
VIRTB_KB_KP7 = 263,
VIRTB_KB_KP8 = 264,
VIRTB_KB_KP9 = 265,
VIRTB_KB_KP_PERIOD = 266,
VIRTB_KB_KP_DIVIDE = 267,
VIRTB_KB_KP_MULTIPLY = 268,
VIRTB_KB_KP_MINUS = 269,
VIRTB_KB_KP_PLUS = 270,
VIRTB_KB_KP_ENTER = 271,
VIRTB_KB_KP_EQUALS = 272,
/* Arrows + Home/End pad */
VIRTB_KB_UP = 273,
VIRTB_KB_DOWN = 274,
VIRTB_KB_RIGHT = 275,
VIRTB_KB_LEFT = 276,
VIRTB_KB_INSERT = 277,
VIRTB_KB_HOME = 278,
VIRTB_KB_END = 279,
VIRTB_KB_PAGEUP = 280,
VIRTB_KB_PAGEDOWN = 281,
/* Function keys */
VIRTB_KB_F1 = 282,
VIRTB_KB_F2 = 283,
VIRTB_KB_F3 = 284,
VIRTB_KB_F4 = 285,
VIRTB_KB_F5 = 286,
VIRTB_KB_F6 = 287,
VIRTB_KB_F7 = 288,
VIRTB_KB_F8 = 289,
VIRTB_KB_F9 = 290,
VIRTB_KB_F10 = 291,
VIRTB_KB_F11 = 292,
VIRTB_KB_F12 = 293,
VIRTB_KB_F13 = 294,
VIRTB_KB_F14 = 295,
VIRTB_KB_F15 = 296,
/* Key state modifier keys */
VIRTB_KB_NUMLOCK = 300,
VIRTB_KB_CAPSLOCK = 301,
VIRTB_KB_SCROLLOCK = 302,
VIRTB_KB_RSHIFT = 303,
VIRTB_KB_LSHIFT = 304,
VIRTB_KB_RCTRL = 305,
VIRTB_KB_LCTRL = 306,
VIRTB_KB_RALT = 307,
VIRTB_KB_LALT = 308,
VIRTB_KB_RMETA = 309,
VIRTB_KB_LMETA = 310,
VIRTB_KB_LSUPER = 311, /* Left "Windows" key */
VIRTB_KB_RSUPER = 312, /* Right "Windows" key */
VIRTB_KB_MODE = 313, /* "Alt Gr" key */
VIRTB_KB_COMPOSE = 314, /* Multi-key compose key */
/* Miscellaneous function keys */
VIRTB_KB_HELP = 315,
VIRTB_KB_PRINT = 316,
VIRTB_KB_SYSREQ = 317,
VIRTB_KB_BREAK = 318,
VIRTB_KB_MENU = 319,
VIRTB_KB_POWER = 320, /* Power Macintosh power key */
VIRTB_KB_EURO = 321, /* Some european keyboards */
VIRTB_KB_UNDO = 322, /* Atari keyboard has Undo */
/* Add any other keys here */
VIRTB_KB_LAST,
/* Mednafen-specific virtual buttons */
// D-pad 0
VIRTB_DP0_U = 0x1000,
VIRTB_DP0_D,
VIRTB_DP0_L,
VIRTB_DP0_R,
// D-pad 1
VIRTB_DP1_U = 0x1100,
VIRTB_DP1_D,
VIRTB_DP1_L,
VIRTB_DP1_R,
// Single row of buttons. Don't use if VIRTB_TOP_* or VIRTB_BOTTOM_* virtual buttons are also used with the device.
// This is for simple devices with one row of action buttons.
VIRTB_0 = 0x2000,
VIRTB_1,
VIRTB_2,
VIRTB_3,
// Top row of buttons, left to right.
VIRTB_TOP_0 = 0x2100,
VIRTB_TOP_1,
VIRTB_TOP_2,
VIRTB_TOP_3,
// Bottom row of buttons.
VIRTB_BOT_0 = 0x2200,
VIRTB_BOT_1,
VIRTB_BOT_2,
VIRTB_BOT_3,
VIRTB_SELECT = 0x2800,
VIRTB_START,
// Diamond-shaped button arrangement
VIRTB_DMD_L = VIRTB_BOT_0, /*0x3000*/ // Treated equivalent to VIRTB_BOT_0 for now.
VIRTB_DMD_R = VIRTB_TOP_1, // Treated equivalent to VIRTB_TOP_1, for now.
VIRTB_DMD_U = VIRTB_TOP_0, // Treated equivalent to VIRTB_TOP_0, for now.
VIRTB_DMD_D = VIRTB_BOT_1, // Treated equivalent to VIRTB_BOT_1, for now.
// Shoulder buttons
VIRTB_SHLDR_L = 0x3100,
VIRTB_SHLDR_R,
VIRTB_LAST
} InputDeviceInputVB;
#endif

View File

@ -7,37 +7,37 @@
typedef struct
{
const char *extension; // Example ".nes"
const char *description; // Example "iNES Format ROM Image"
const char* extension; // Example ".nes"
const char* description; // Example "iNES Format ROM Image"
} FileExtensionSpecStruct;
#include "file.h"
enum
{
MDFN_ROTATE0 = 0,
MDFN_ROTATE90,
MDFN_ROTATE180,
MDFN_ROTATE270
MDFN_ROTATE0 = 0,
MDFN_ROTATE90,
MDFN_ROTATE180,
MDFN_ROTATE270
};
typedef enum
{
VIDSYS_NONE, // Can be used internally in system emulation code, but it is an error condition to let it continue to be
// after the Load() or LoadCD() function returns!
VIDSYS_PAL,
VIDSYS_PAL_M, // Same timing as NTSC, but uses PAL-style colour encoding
VIDSYS_NTSC,
VIDSYS_SECAM
VIDSYS_NONE, // Can be used internally in system emulation code, but it is an error condition to let it continue to be
// after the Load() or LoadCD() function returns!
VIDSYS_PAL,
VIDSYS_PAL_M, // Same timing as NTSC, but uses PAL-style colour encoding
VIDSYS_NTSC,
VIDSYS_SECAM
} VideoSystems;
typedef enum
{
GMT_CART, // Self-explanatory!
GMT_ARCADE, // VS Unisystem, PC-10...
GMT_DISK, // Famicom Disk System, mostly
GMT_CDROM, // PC Engine CD, PC-FX
GMT_PLAYER // Music player(NSF, HES, GSF)
GMT_CART, // Self-explanatory!
GMT_ARCADE, // VS Unisystem, PC-10...
GMT_DISK, // Famicom Disk System, mostly
GMT_CDROM, // PC Engine CD, PC-FX
GMT_PLAYER // Music player(NSF, HES, GSF)
} GameMediumTypes;
#include "state.h"
@ -45,63 +45,63 @@ typedef enum
typedef enum
{
IDIT_BUTTON, // 1-bit
IDIT_BUTTON_CAN_RAPID, // 1-bit
IDIT_BUTTON_BYTE, // 8-bits, Button as a byte instead of a bit.
IDIT_X_AXIS, // (mouse) 32-bits, signed, fixed-point: 1.15.16 - in-screen/window range: [0.0, nominal_width)
IDIT_Y_AXIS, // (mouse) 32-bits, signed, fixed-point: 1.15.16 - in-screen/window range: [0.0, nominal_height)
IDIT_X_AXIS_REL, // (mouse) 32-bits, signed
IDIT_Y_AXIS_REL, // (mouse) 32-bits, signed
IDIT_BYTE_SPECIAL,
IDIT_BUTTON_ANALOG, // 32-bits, 0 - 32767
IDIT_RUMBLE, // 32-bits, lower 8 bits are weak rumble(0-255), next 8 bits are strong rumble(0-255), 0=no rumble, 255=max rumble. Somewhat subjective, too...
// May extend to 16-bit each in the future.
// It's also rather a special case of game module->driver code communication.
IDIT_BUTTON, // 1-bit
IDIT_BUTTON_CAN_RAPID, // 1-bit
IDIT_BUTTON_BYTE, // 8-bits, Button as a byte instead of a bit.
IDIT_X_AXIS, // (mouse) 32-bits, signed, fixed-point: 1.15.16 - in-screen/window range: [0.0, nominal_width)
IDIT_Y_AXIS, // (mouse) 32-bits, signed, fixed-point: 1.15.16 - in-screen/window range: [0.0, nominal_height)
IDIT_X_AXIS_REL, // (mouse) 32-bits, signed
IDIT_Y_AXIS_REL, // (mouse) 32-bits, signed
IDIT_BYTE_SPECIAL,
IDIT_BUTTON_ANALOG, // 32-bits, 0 - 32767
IDIT_RUMBLE, // 32-bits, lower 8 bits are weak rumble(0-255), next 8 bits are strong rumble(0-255), 0=no rumble, 255=max rumble. Somewhat subjective, too...
// May extend to 16-bit each in the future.
// It's also rather a special case of game module->driver code communication.
} InputDeviceInputType;
#include "git-virtb.h"
typedef struct
{
const char *SettingName; // No spaces, shouldbe all a-z0-9 and _. Definitely no ~!
const char *Name;
/*const InputDeviceInputVB VirtButton;*/
const int ConfigOrder; // Configuration order during in-game config process, -1 for no config.
const InputDeviceInputType Type;
const char *ExcludeName; // SettingName of a button that can't be pressed at the same time as this button
// due to physical limitations.
const char*
SettingName; // No spaces, shouldbe all a-z0-9 and _. Definitely no ~!
const char* Name;
const int ConfigOrder; // Configuration order during in-game config process, -1 for no config.
const InputDeviceInputType Type;
const char*
ExcludeName; // SettingName of a button that can't be pressed at the same time as this button
// due to physical limitations.
const char *RotateName[3]; // 90, 180, 270
//const char *Rotate180Name;
//const char *Rotate270Name;
const char* RotateName[3]; // 90, 180, 270
//const char *Rotate180Name;
//const char *Rotate270Name;
} InputDeviceInputInfoStruct;
typedef struct
{
const char *ShortName;
const char *FullName;
const char *Description;
const char* ShortName;
const char* FullName;
const char* Description;
//struct InputPortInfoStruct *PortExpanderDeviceInfo;
const void *PortExpanderDeviceInfo; // DON'T USE, IT'S NOT IMPLEMENTED PROPERLY CURRENTLY.
int NumInputs; // Usually just the number of buttons....OR if PortExpanderDeviceInfo is non-NULL, it's the number of input
// ports this port expander device provides.
const InputDeviceInputInfoStruct *IDII;
//struct InputPortInfoStruct *PortExpanderDeviceInfo;
const void*
PortExpanderDeviceInfo; // DON'T USE, IT'S NOT IMPLEMENTED PROPERLY CURRENTLY.
int NumInputs; // Usually just the number of buttons....OR if PortExpanderDeviceInfo is non-NULL, it's the number of input
// ports this port expander device provides.
const InputDeviceInputInfoStruct* IDII;
} InputDeviceInfoStruct;
typedef struct
{
const char *ShortName;
const char *FullName;
int NumTypes; // Number of unique input devices available for this input port
InputDeviceInfoStruct *DeviceInfo;
const char *DefaultDevice; // Default device for this port.
const char* ShortName;
const char* FullName;
int NumTypes; // Number of unique input devices available for this input port
InputDeviceInfoStruct* DeviceInfo;
const char* DefaultDevice; // Default device for this port.
} InputPortInfoStruct;
typedef struct
{
int InputPorts;
const InputPortInfoStruct *Types;
int InputPorts;
const InputPortInfoStruct* Types;
} InputInfoStruct;
struct MemoryPatch;
@ -110,259 +110,260 @@ struct MemoryPatch;
// (for DoSimpleCommand() )
enum
{
MDFN_MSC_RESET = 0x01,
MDFN_MSC_POWER = 0x02,
MDFN_MSC_RESET = 0x01,
MDFN_MSC_POWER = 0x02,
MDFN_MSC_INSERT_COIN = 0x07,
MDFN_MSC_INSERT_COIN = 0x07,
// If we ever support arcade systems, we'll abstract DIP switches differently...maybe.
MDFN_MSC_TOGGLE_DIP0 = 0x10,
MDFN_MSC_TOGGLE_DIP1,
MDFN_MSC_TOGGLE_DIP2,
MDFN_MSC_TOGGLE_DIP3,
MDFN_MSC_TOGGLE_DIP4,
MDFN_MSC_TOGGLE_DIP5,
MDFN_MSC_TOGGLE_DIP6,
MDFN_MSC_TOGGLE_DIP7,
MDFN_MSC_TOGGLE_DIP8,
MDFN_MSC_TOGGLE_DIP9,
MDFN_MSC_TOGGLE_DIP10,
MDFN_MSC_TOGGLE_DIP11,
MDFN_MSC_TOGGLE_DIP12,
MDFN_MSC_TOGGLE_DIP13,
MDFN_MSC_TOGGLE_DIP14,
MDFN_MSC_TOGGLE_DIP15,
// If we ever support arcade systems, we'll abstract DIP switches differently...maybe.
MDFN_MSC_TOGGLE_DIP0 = 0x10,
MDFN_MSC_TOGGLE_DIP1,
MDFN_MSC_TOGGLE_DIP2,
MDFN_MSC_TOGGLE_DIP3,
MDFN_MSC_TOGGLE_DIP4,
MDFN_MSC_TOGGLE_DIP5,
MDFN_MSC_TOGGLE_DIP6,
MDFN_MSC_TOGGLE_DIP7,
MDFN_MSC_TOGGLE_DIP8,
MDFN_MSC_TOGGLE_DIP9,
MDFN_MSC_TOGGLE_DIP10,
MDFN_MSC_TOGGLE_DIP11,
MDFN_MSC_TOGGLE_DIP12,
MDFN_MSC_TOGGLE_DIP13,
MDFN_MSC_TOGGLE_DIP14,
MDFN_MSC_TOGGLE_DIP15,
// n of DISKn translates to is emulation module specific.
MDFN_MSC_INSERT_DISK0 = 0x20,
MDFN_MSC_INSERT_DISK1,
MDFN_MSC_INSERT_DISK2,
MDFN_MSC_INSERT_DISK3,
MDFN_MSC_INSERT_DISK4,
MDFN_MSC_INSERT_DISK5,
MDFN_MSC_INSERT_DISK6,
MDFN_MSC_INSERT_DISK7,
MDFN_MSC_INSERT_DISK8,
MDFN_MSC_INSERT_DISK9,
MDFN_MSC_INSERT_DISK10,
MDFN_MSC_INSERT_DISK11,
MDFN_MSC_INSERT_DISK12,
MDFN_MSC_INSERT_DISK13,
MDFN_MSC_INSERT_DISK14,
MDFN_MSC_INSERT_DISK15,
// n of DISKn translates to is emulation module specific.
MDFN_MSC_INSERT_DISK0 = 0x20,
MDFN_MSC_INSERT_DISK1,
MDFN_MSC_INSERT_DISK2,
MDFN_MSC_INSERT_DISK3,
MDFN_MSC_INSERT_DISK4,
MDFN_MSC_INSERT_DISK5,
MDFN_MSC_INSERT_DISK6,
MDFN_MSC_INSERT_DISK7,
MDFN_MSC_INSERT_DISK8,
MDFN_MSC_INSERT_DISK9,
MDFN_MSC_INSERT_DISK10,
MDFN_MSC_INSERT_DISK11,
MDFN_MSC_INSERT_DISK12,
MDFN_MSC_INSERT_DISK13,
MDFN_MSC_INSERT_DISK14,
MDFN_MSC_INSERT_DISK15,
MDFN_MSC_INSERT_DISK = 0x30,
MDFN_MSC_EJECT_DISK = 0x31,
MDFN_MSC_INSERT_DISK = 0x30,
MDFN_MSC_EJECT_DISK = 0x31,
// This command should select the next disk or disk side in the set and use MDFN_DispMessage() to show which disk is selected.
// (If it's only allowed while a disk is ejected, or not, is emulation module specific.
MDFN_MSC_SELECT_DISK = 0x32,
// This command should select the next disk or disk side in the set and use MDFN_DispMessage() to show which disk is selected.
// (If it's only allowed while a disk is ejected, or not, is emulation module specific.
MDFN_MSC_SELECT_DISK = 0x32,
MDFN_MSC__LAST = 0x3F // WARNING: Increasing(or having the enum'd value of a command greater than this :b) this will necessitate a change to the netplay protocol.
MDFN_MSC__LAST = 0x3F // WARNING: Increasing(or having the enum'd value of a command greater than this :b) this will necessitate a change to the netplay protocol.
};
typedef struct
{
// Pitch(32-bit) must be equal to width and >= the "fb_width" specified in the MDFNGI struct for the emulated system.
// Height must be >= to the "fb_height" specified in the MDFNGI struct for the emulated system.
// The framebuffer pointed to by surface->pixels is written to by the system emulation code.
MDFN_Surface *surface;
// Pitch(32-bit) must be equal to width and >= the "fb_width" specified in the MDFNGI struct for the emulated system.
// Height must be >= to the "fb_height" specified in the MDFNGI struct for the emulated system.
// The framebuffer pointed to by surface->pixels is written to by the system emulation code.
MDFN_Surface* surface;
// Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size
// of the image. If the emulated system sets the elements of LineWidths, then the horizontal offset(x) and width(w) of this structure
// are ignored while drawing the image.
MDFN_Rect DisplayRect;
// Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size
// of the image. If the emulated system sets the elements of LineWidths, then the horizontal offset(x) and width(w) of this structure
// are ignored while drawing the image.
MDFN_Rect DisplayRect;
// Pointer to an array of MDFN_Rect, number of elements = fb_height, set by the driver code. Individual MDFN_Rect structs written
// to by system emulation code. If the emulated system doesn't support multiple screen widths per frame, or if you handle
// such a situation by outputting at a constant width-per-frame that is the least-common-multiple of the screen widths, then
// you can ignore this. If you do wish to use this, you must set all elements every frame.
int32_t *LineWidths;
// Pointer to an array of MDFN_Rect, number of elements = fb_height, set by the driver code. Individual MDFN_Rect structs written
// to by system emulation code. If the emulated system doesn't support multiple screen widths per frame, or if you handle
// such a situation by outputting at a constant width-per-frame that is the least-common-multiple of the screen widths, then
// you can ignore this. If you do wish to use this, you must set all elements every frame.
int32_t* LineWidths;
// TODO
bool *IsFMV;
// TODO
bool* IsFMV;
// Set(optionally) by emulation code. If InterlaceOn is true, then assume field height is 1/2 DisplayRect.h, and
// only every other line in surface (with the start line defined by InterlacedField) has valid data
// (it's up to internal Mednafen code to deinterlace it).
bool InterlaceOn;
bool InterlaceField;
// Set(optionally) by emulation code. If InterlaceOn is true, then assume field height is 1/2 DisplayRect.h, and
// only every other line in surface (with the start line defined by InterlacedField) has valid data
// (it's up to internal Mednafen code to deinterlace it).
bool InterlaceOn;
bool InterlaceField;
// Skip rendering this frame if true. Set by the driver code.
int skip;
// Skip rendering this frame if true. Set by the driver code.
int skip;
//
// If sound is disabled, the driver code must set SoundRate to false, SoundBuf to NULL, SoundBufMaxSize to 0.
//
// If sound is disabled, the driver code must set SoundRate to false, SoundBuf to NULL, SoundBufMaxSize to 0.
// Will be set to TRUE if the sound format(only rate for now, at least) has changed since the last call to Emulate(), FALSE otherwise.
// Will be set to TRUE on the first call to the Emulate() function/method
bool SoundFormatChanged;
// Will be set to TRUE if the sound format(only rate for now, at least) has changed since the last call to Emulate(), FALSE otherwise.
// Will be set to TRUE on the first call to the Emulate() function/method
bool SoundFormatChanged;
// Sound rate. Set by driver side.
double SoundRate;
// Sound rate. Set by driver side.
double SoundRate;
// Pointer to sound buffer, set by the driver code, that the emulation code should render sound to.
// Guaranteed to be at least 500ms in length, but emulation code really shouldn't exceed 40ms or so. Additionally, if emulation code
// generates >= 100ms,
// DEPRECATED: Emulation code may set this pointer to a sound buffer internal to the emulation module.
int16 *SoundBuf;
// Pointer to sound buffer, set by the driver code, that the emulation code should render sound to.
// Guaranteed to be at least 500ms in length, but emulation code really shouldn't exceed 40ms or so. Additionally, if emulation code
// generates >= 100ms,
// DEPRECATED: Emulation code may set this pointer to a sound buffer internal to the emulation module.
int16* SoundBuf;
// Maximum size of the sound buffer, in frames. Set by the driver code.
int32 SoundBufMaxSize;
// Maximum size of the sound buffer, in frames. Set by the driver code.
int32 SoundBufMaxSize;
// Number of frames currently in internal sound buffer. Set by the system emulation code, to be read by the driver code.
int32 SoundBufSize;
int32 SoundBufSizeALMS; // SoundBufSize value at last MidSync(), 0
// if mid sync isn't implemented for the emulation module in use.
// Number of frames currently in internal sound buffer. Set by the system emulation code, to be read by the driver code.
int32 SoundBufSize;
int32 SoundBufSizeALMS; // SoundBufSize value at last MidSync(), 0
// if mid sync isn't implemented for the emulation module in use.
// Number of cycles that this frame consumed, using MDFNGI::MasterClock as a time base.
// Set by emulation code.
int64 MasterCycles;
int64 MasterCyclesALMS; // MasterCycles value at last MidSync(), 0
// if mid sync isn't implemented for the emulation module in use.
// Number of cycles that this frame consumed, using MDFNGI::MasterClock as a time base.
// Set by emulation code.
int64 MasterCycles;
int64 MasterCyclesALMS; // MasterCycles value at last MidSync(), 0
// if mid sync isn't implemented for the emulation module in use.
// Current sound volume(0.000...<=volume<=1.000...). If, after calling Emulate(), it is still != 1, Mednafen will handle it internally.
// Emulation modules can handle volume themselves if they like, for speed reasons. If they do, afterwards, they should set its value to 1.
double SoundVolume;
// Current sound volume(0.000...<=volume<=1.000...). If, after calling Emulate(), it is still != 1, Mednafen will handle it internally.
// Emulation modules can handle volume themselves if they like, for speed reasons. If they do, afterwards, they should set its value to 1.
double SoundVolume;
// Current sound speed multiplier. Set by the driver code. If, after calling Emulate(), it is still != 1, Mednafen will handle it internally
// by resampling the audio. This means that emulation modules can handle(and set the value to 1 after handling it) it if they want to get the most
// performance possible. HOWEVER, emulation modules must make sure the value is in a range(with minimum and maximum) that their code can handle
// before they try to handle it.
double soundmultiplier;
// Current sound speed multiplier. Set by the driver code. If, after calling Emulate(), it is still != 1, Mednafen will handle it internally
// by resampling the audio. This means that emulation modules can handle(and set the value to 1 after handling it) it if they want to get the most
// performance possible. HOWEVER, emulation modules must make sure the value is in a range(with minimum and maximum) that their code can handle
// before they try to handle it.
double soundmultiplier;
// True if we want to rewind one frame. Set by the driver code.
bool NeedRewind;
// True if we want to rewind one frame. Set by the driver code.
bool NeedRewind;
// Sound reversal during state rewinding is normally done in mednafen.cpp, but
// individual system emulation code can also do it if this is set, and clear it after it's done.
// (Also, the driver code shouldn't touch this variable)
bool NeedSoundReverse;
// Sound reversal during state rewinding is normally done in mednafen.cpp, but
// individual system emulation code can also do it if this is set, and clear it after it's done.
// (Also, the driver code shouldn't touch this variable)
bool NeedSoundReverse;
} EmulateSpecStruct;
typedef enum
{
MODPRIO_INTERNAL_EXTRA_LOW = 0, // For "cdplay" module, mostly.
MODPRIO_INTERNAL_EXTRA_LOW = 0, // For "cdplay" module, mostly.
MODPRIO_INTERNAL_LOW = 10,
MODPRIO_EXTERNAL_LOW = 20,
MODPRIO_INTERNAL_HIGH = 30,
MODPRIO_EXTERNAL_HIGH = 40
MODPRIO_INTERNAL_LOW = 10,
MODPRIO_EXTERNAL_LOW = 20,
MODPRIO_INTERNAL_HIGH = 30,
MODPRIO_EXTERNAL_HIGH = 40
} ModPrio;
class CDIF;
typedef struct
{
/* Private functions to Mednafen. Do not call directly
from the driver code, or else bad things shall happen. Maybe. Probably not, but don't
do it(yet)!
*/
// Short system name, lowercase a-z, 0-9, and _ are the only allowable characters!
const char *shortname;
/* Private functions to Mednafen. Do not call directly
from the driver code, or else bad things shall happen. Maybe. Probably not, but don't
do it(yet)!
*/
// Short system name, lowercase a-z, 0-9, and _ are the only allowable characters!
const char* shortname;
// Full system name. Preferably English letters, but can be UTF8
const char *fullname;
// Full system name. Preferably English letters, but can be UTF8
const char* fullname;
// Pointer to an array of FileExtensionSpecStruct, with the last entry being { NULL, NULL } to terminate the list.
// This list is used to make best-guess choices, when calling the TestMagic*() functions would be unreasonable, such
// as when scanning a ZIP archive for a file to load. The list may also be used in the future for GUI file open windows.
const FileExtensionSpecStruct *FileExtensions;
// Pointer to an array of FileExtensionSpecStruct, with the last entry being { NULL, NULL } to terminate the list.
// This list is used to make best-guess choices, when calling the TestMagic*() functions would be unreasonable, such
// as when scanning a ZIP archive for a file to load. The list may also be used in the future for GUI file open windows.
const FileExtensionSpecStruct* FileExtensions;
ModPrio ModulePriority;
ModPrio ModulePriority;
void *Debugger;
InputInfoStruct *InputInfo;
void* Debugger;
InputInfoStruct* InputInfo;
// Returns 1 on successful load, 0 on fatal error(deprecated: -1 on unrecognized format)
int (*Load)(const char *name, MDFNFILE *fp);
// Returns 1 on successful load, 0 on fatal error(deprecated: -1 on unrecognized format)
int (*Load)(const char* name, MDFNFILE* fp);
//
// (*CDInterfaces).size() is guaranteed to be >= 1.
int (*LoadCD)(std::vector<CDIF *> *CDInterfaces);
bool (*TestMagicCD)(std::vector<CDIF *> *CDInterfaces);
//
// (*CDInterfaces).size() is guaranteed to be >= 1.
int (*LoadCD)(std::vector<CDIF*>* CDInterfaces);
bool (*TestMagicCD)(std::vector<CDIF*>* CDInterfaces);
void (*CloseGame)(void);
void (*CloseGame)(void);
void (*SetLayerEnableMask)(uint64 mask); // Video
const char *LayerNames;
void (*SetLayerEnableMask)(uint64 mask); // Video
const char* LayerNames;
void (*SetChanEnableMask)(uint64 mask); // Audio(TODO, placeholder)
const char *ChanNames;
void (*SetChanEnableMask)(uint64 mask); // Audio(TODO, placeholder)
const char* ChanNames;
void (*InstallReadPatch)(uint32 address);
void (*RemoveReadPatches)(void);
uint8 (*MemRead)(uint32 addr);
void (*InstallReadPatch)(uint32 address);
void (*RemoveReadPatches)(void);
uint8(*MemRead)(uint32 addr);
bool SaveStateAltersState; // true for bsnes and some libco-style emulators, false otherwise.
// Main save state routine, called by the save state code in state.cpp.
// When saving, load is set to 0. When loading, load is set to the version field of the save state being loaded.
// data_only is true when the save state data is temporary, such as being saved into memory for state rewinding.
int (*StateAction)(StateMem *sm, int load, int data_only);
bool SaveStateAltersState; // true for bsnes and some libco-style emulators, false otherwise.
// Main save state routine, called by the save state code in state.cpp.
// When saving, load is set to 0. When loading, load is set to the version field of the save state being loaded.
// data_only is true when the save state data is temporary, such as being saved into memory for state rewinding.
int (*StateAction)(StateMem* sm, int load, int data_only);
void (*Emulate)(EmulateSpecStruct *espec);
void (*SetInput)(int port, const char *type, void *ptr);
void (*Emulate)(EmulateSpecStruct* espec);
void (*SetInput)(int port, const char* type, void* ptr);
void (*DoSimpleCommand)(int cmd);
void (*DoSimpleCommand)(int cmd);
const MDFNSetting *Settings;
const MDFNSetting* Settings;
// Time base for EmulateSpecStruct::MasterCycles
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
int64 MasterClock;
// Time base for EmulateSpecStruct::MasterCycles
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
int64 MasterClock;
uint32 fps; // frames per second * 65536 * 256, truncated
uint32 fps; // frames per second * 65536 * 256, truncated
// multires is a hint that, if set, indicates that the system has fairly programmable video modes(particularly, the ability
// to display multiple horizontal resolutions, such as the PCE, PC-FX, or Genesis). In practice, it will cause the driver
// code to set the linear interpolation on by default.
//
// lcm_width and lcm_height are the least common multiples of all possible
// resolutions in the frame buffer as specified by DisplayRect/LineWidths(Ex for PCE: widths of 256, 341.333333, 512,
// lcm = 1024)
//
// nominal_width and nominal_height specify the resolution that Mednafen should display
// the framebuffer image in at 1x scaling, scaled from the dimensions of DisplayRect, and optionally the LineWidths array
// passed through espec to the Emulate() function.
//
bool multires;
// multires is a hint that, if set, indicates that the system has fairly programmable video modes(particularly, the ability
// to display multiple horizontal resolutions, such as the PCE, PC-FX, or Genesis). In practice, it will cause the driver
// code to set the linear interpolation on by default.
//
// lcm_width and lcm_height are the least common multiples of all possible
// resolutions in the frame buffer as specified by DisplayRect/LineWidths(Ex for PCE: widths of 256, 341.333333, 512,
// lcm = 1024)
//
// nominal_width and nominal_height specify the resolution that Mednafen should display
// the framebuffer image in at 1x scaling, scaled from the dimensions of DisplayRect, and optionally the LineWidths array
// passed through espec to the Emulate() function.
//
bool multires;
int lcm_width;
int lcm_height;
int lcm_width;
int lcm_height;
void *dummy_separator; //
void* dummy_separator; //
int nominal_width;
int nominal_height;
int nominal_width;
int nominal_height;
int fb_width; // Width of the framebuffer(not necessarily width of the image). MDFN_Surface width should be >= this.
int fb_height; // Height of the framebuffer passed to the Emulate() function(not necessarily height of the image)
int fb_width; // Width of the framebuffer(not necessarily width of the image). MDFN_Surface width should be >= this.
int fb_height; // Height of the framebuffer passed to the Emulate() function(not necessarily height of the image)
int soundchan; // Number of output sound channels.
int soundchan; // Number of output sound channels.
int rotated;
int rotated;
uint8 *name; /* Game name, UTF8 encoding */
uint8 MD5[16];
uint8 GameSetMD5[16]; /* A unique ID for the game set this CD belongs to, only used in PC-FX emulation. */
bool GameSetMD5Valid; /* True if GameSetMD5 is valid. */
uint8* name; /* Game name, UTF8 encoding */
uint8 MD5[16];
uint8 GameSetMD5[16]; /* A unique ID for the game set this CD belongs to, only used in PC-FX emulation. */
bool GameSetMD5Valid; /* True if GameSetMD5 is valid. */
int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */
int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */
VideoSystems VideoSystem;
GameMediumTypes GameType;
VideoSystems VideoSystem;
GameMediumTypes GameType;
//int DiskLogicalCount; // A single double-sided disk would be 2 here.
//const char *DiskNames; // Null-terminated.
//int DiskLogicalCount; // A single double-sided disk would be 2 here.
//const char *DiskNames; // Null-terminated.
const char *cspecial; /* Special cart expansion: DIP switches, barcode reader, etc. */
const char*
cspecial; /* Special cart expansion: DIP switches, barcode reader, etc. */
std::vector<const char *>DesiredInput; // Desired input device for the input ports, NULL for don't care
std::vector<const char*>DesiredInput; // Desired input device for the input ports, NULL for don't care
double mouse_sensitivity;
double mouse_sensitivity;
} MDFNGI;
#endif

View File

@ -14,10 +14,6 @@ void MDFN_indent(int indent);
#define MDFNI_printf MDFN_printf
/* Displays an error. Can block or not. */
void MDFND_PrintError(const char *s);
void MDFND_Message(const char *s);
uint32 MDFND_GetTime(void);
/* path = path of game/file to load. returns NULL on failure. */

View File

@ -86,10 +86,6 @@ INLINE uint32 SF_FORCE_D(double *) { return(0); }
#define SFARRAY64N(x, l, n) { (x), (uint32)((l) * sizeof(uint64)), MDFNSTATE_RLSB64 | SF_FORCE_A64(x), n }
#define SFARRAY64(x, l) SFARRAY64N((x), (l), #x)
#if SIZEOF_DOUBLE != 8
#error "sizeof(double) != 8"
#endif
#define SFARRAYDN(x, l, n) { (x), (uint32)((l) * 8), MDFNSTATE_RLSB64 | SF_FORCE_D(x), n }
#define SFARRAYD(x, l) SFARRAYDN((x), (l), #x)

View File

@ -2,8 +2,6 @@
extern "C" {
#endif
#ifdef WANT_CRC32
static const unsigned long crc_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
@ -79,8 +77,6 @@ unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int le
return crc ^ 0xffffffffL;
}
#endif
#ifdef __cplusplus
}
#endif