diff --git a/projectfiles/visualstudio-2003-libretro-xbox1/fba_vs2003_libretro_xbox1.vcproj b/projectfiles/visualstudio-2003-libretro-xbox1/fba_vs2003_libretro_xbox1.vcproj index ce97c3332..a4b004389 100644 --- a/projectfiles/visualstudio-2003-libretro-xbox1/fba_vs2003_libretro_xbox1.vcproj +++ b/projectfiles/visualstudio-2003-libretro-xbox1/fba_vs2003_libretro_xbox1.vcproj @@ -245,6 +245,9 @@ + + @@ -257,6 +260,9 @@ + + @@ -609,6 +615,9 @@ + + @@ -806,6 +815,9 @@ + + @@ -830,9 +842,15 @@ + + + + @@ -1472,6 +1490,31 @@ RelativePath="..\..\src\burn\drv\toaplan\toaplan1.cpp"> + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RelativePath="..\..\src\cpu\m68k\m68kopac.c"> - - - - - - - - - - - - - - - + RelativePath="..\..\src\cpu\m68k\m68kopdm.c"> + + + + + + @@ -69,7 +71,7 @@ - + @@ -77,7 +79,7 @@ - + @@ -145,6 +147,7 @@ + @@ -196,6 +199,7 @@ + @@ -204,7 +208,9 @@ + + @@ -310,7 +316,7 @@ - + @@ -440,6 +446,7 @@ + CompileAsC CompileAsC @@ -557,6 +564,7 @@ true + true @@ -638,14 +646,13 @@ true + - - - + {00AAF92F-A249-4DF2-AE24-0C5427DB319E} @@ -729,7 +736,7 @@ false $(OutDir)$(ProjectName).pch MultiThreadedDebug - _DEBUG;_XBOX;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static + _DEBUG;_XBOX;_XBOX360;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static;MSB_FIRST;__LIBRETRO_OPTIMIZATIONS__;FRONTEND_SUPPORTS_RGB565 Callcap $(SolutionDir)\..\..\src\burn\drv\taito;$(SolutionDir)\..\..\src\dep\generated;$(SolutionDir)\..\..\src\burner\libretro;$(SolutionDir)\..\..\src\burner;$(SolutionDir)\..\..\src\burn;$(SolutionDir)\..\..\src\burn\drv\pgm;$(SolutionDir)\..\..\src\burn\devices;$(SolutionDir)\..\..\src\burn\snd;$(SolutionDir)\..\..\src\cpu\;$(SolutionDir)\..\..\src\cpu\arm;$(SolutionDir)\..\..\src\cpu\arm7;$(SolutionDir)\..\..\src\cpu\h6280;$(SolutionDir)\..\..\src\cpu\hd6309;$(SolutionDir)\..\..\src\cpu\i8039;$(SolutionDir)\..\..\src\cpu\konami;$(SolutionDir)\..\..\src\cpu\m6502;$(SolutionDir)\..\..\src\cpu\m6800;$(SolutionDir)\..\..\src\cpu\m6805;$(SolutionDir)\..\..\src\cpu\m6809;$(SolutionDir)\..\..\src\cpu\m68k;$(SolutionDir)\..\..\src\cpu\nec;$(SolutionDir)\..\..\src\cpu\s2650;$(SolutionDir)\..\..\src\cpu\sh2;$(SolutionDir)\..\..\src\cpu\z80;$(SolutionDir)\..\..\src\intf\input;$(SolutionDir)\..\..\src\intf;$(SolutionDir)\..\..\src\dep\libs\zlib;$(SolutionDir)\..\..\src\intf\cd true @@ -750,7 +757,7 @@ false $(OutDir)$(ProjectName).pch MultiThreadedDebug - _DEBUG;_XBOX;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static + _DEBUG;_XBOX;_XBOX360;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static;MSB_FIRST;__LIBRETRO_OPTIMIZATIONS__;FRONTEND_SUPPORTS_RGB565 Callcap $(SolutionDir)\..\..\src\burn\drv\taito;$(SolutionDir)\..\..\src\dep\generated;$(SolutionDir)\..\..\src\burner\libretro;$(SolutionDir)\..\..\src\burner;$(SolutionDir)\..\..\src\burn;$(SolutionDir)\..\..\src\burn\drv\pgm;$(SolutionDir)\..\..\src\burn\devices;$(SolutionDir)\..\..\src\burn\snd;$(SolutionDir)\..\..\src\cpu\;$(SolutionDir)\..\..\src\cpu\arm;$(SolutionDir)\..\..\src\cpu\arm7;$(SolutionDir)\..\..\src\cpu\h6280;$(SolutionDir)\..\..\src\cpu\hd6309;$(SolutionDir)\..\..\src\cpu\i8039;$(SolutionDir)\..\..\src\cpu\konami;$(SolutionDir)\..\..\src\cpu\m6502;$(SolutionDir)\..\..\src\cpu\m6800;$(SolutionDir)\..\..\src\cpu\m6805;$(SolutionDir)\..\..\src\cpu\m6809;$(SolutionDir)\..\..\src\cpu\m68k;$(SolutionDir)\..\..\src\cpu\nec;$(SolutionDir)\..\..\src\cpu\s2650;$(SolutionDir)\..\..\src\cpu\sh2;$(SolutionDir)\..\..\src\cpu\z80;$(SolutionDir)\..\..\src\intf\input;$(SolutionDir)\..\..\src\intf;$(SolutionDir)\..\..\src\dep\libs\zlib;$(SolutionDir)\..\..\src\intf\cd true @@ -772,7 +779,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;PROFILE;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static + NDEBUG;_XBOX;_XBOX360;PROFILE;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static;MSB_FIRST;__LIBRETRO_OPTIMIZATIONS__;FRONTEND_SUPPORTS_RGB565 Callcap $(SolutionDir)\..\..\src\burn\drv\taito;$(SolutionDir)\..\..\src\dep\generated;$(SolutionDir)\..\..\src\burner\libretro;$(SolutionDir)\..\..\src\burner;$(SolutionDir)\..\..\src\burn;$(SolutionDir)\..\..\src\burn\drv\pgm;$(SolutionDir)\..\..\src\burn\devices;$(SolutionDir)\..\..\src\burn\snd;$(SolutionDir)\..\..\src\cpu\;$(SolutionDir)\..\..\src\cpu\arm;$(SolutionDir)\..\..\src\cpu\arm7;$(SolutionDir)\..\..\src\cpu\h6280;$(SolutionDir)\..\..\src\cpu\hd6309;$(SolutionDir)\..\..\src\cpu\i8039;$(SolutionDir)\..\..\src\cpu\konami;$(SolutionDir)\..\..\src\cpu\m6502;$(SolutionDir)\..\..\src\cpu\m6800;$(SolutionDir)\..\..\src\cpu\m6805;$(SolutionDir)\..\..\src\cpu\m6809;$(SolutionDir)\..\..\src\cpu\m68k;$(SolutionDir)\..\..\src\cpu\nec;$(SolutionDir)\..\..\src\cpu\s2650;$(SolutionDir)\..\..\src\cpu\sh2;$(SolutionDir)\..\..\src\cpu\z80;$(SolutionDir)\..\..\src\intf\input;$(SolutionDir)\..\..\src\intf;$(SolutionDir)\..\..\src\dep\libs\zlib;$(SolutionDir)\..\..\src\intf\cd true @@ -798,7 +805,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static + NDEBUG;_XBOX;_XBOX360;PROFILE;FASTCAP;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static;MSB_FIRST;__LIBRETRO_OPTIMIZATIONS__;FRONTEND_SUPPORTS_RGB565 $(SolutionDir)\..\..\src\burn\drv\taito;$(SolutionDir)\..\..\src\generated;$(SolutionDir)\..\..\src\burner\libretro;$(SolutionDir)\..\..\src\burner;$(SolutionDir)\..\..\src\burn;$(SolutionDir)\..\..\src\burn\drv\pgm;$(SolutionDir)\..\..\src\burn\devices;$(SolutionDir)\..\..\src\burn\snd;$(SolutionDir)\..\..\src\cpu\;$(SolutionDir)\..\..\src\cpu\arm;$(SolutionDir)\..\..\src\cpu\arm7;$(SolutionDir)\..\..\src\cpu\h6280;$(SolutionDir)\..\..\src\cpu\hd6309;$(SolutionDir)\..\..\src\cpu\i8039;$(SolutionDir)\..\..\src\cpu\konami;$(SolutionDir)\..\..\src\cpu\m6502;$(SolutionDir)\..\..\src\cpu\m6800;$(SolutionDir)\..\..\src\cpu\m6805;$(SolutionDir)\..\..\src\cpu\m6809;$(SolutionDir)\..\..\src\cpu\m68k;$(SolutionDir)\..\..\src\cpu\nec;$(SolutionDir)\..\..\src\cpu\s2650;$(SolutionDir)\..\..\src\cpu\sh2;$(SolutionDir)\..\..\src\cpu\z80;$(SolutionDir)\..\..\src\intf\input;$(SolutionDir)\..\..\src\intf;$(SolutionDir)\..\..\src\dep\libs\zlib;$(SolutionDir)\..\..\src\intf\cd true @@ -821,7 +828,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static + NDEBUG;_XBOX;_XBOX360;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static;MSB_FIRST;__LIBRETRO_OPTIMIZATIONS__;FRONTEND_SUPPORTS_RGB565 $(SolutionDir)\..\..\src\burn\drv\taito;$(SolutionDir)\..\..\src\dep\generated;$(SolutionDir)\..\..\src\burner\libretro;$(SolutionDir)\..\..\src\burner;$(SolutionDir)\..\..\src\burn;$(SolutionDir)\..\..\src\burn\drv\pgm;$(SolutionDir)\..\..\src\burn\devices;$(SolutionDir)\..\..\src\burn\snd;$(SolutionDir)\..\..\src\cpu\;$(SolutionDir)\..\..\src\cpu\arm;$(SolutionDir)\..\..\src\cpu\arm7;$(SolutionDir)\..\..\src\cpu\h6280;$(SolutionDir)\..\..\src\cpu\hd6309;$(SolutionDir)\..\..\src\cpu\i8039;$(SolutionDir)\..\..\src\cpu\konami;$(SolutionDir)\..\..\src\cpu\m6502;$(SolutionDir)\..\..\src\cpu\m6800;$(SolutionDir)\..\..\src\cpu\m6805;$(SolutionDir)\..\..\src\cpu\m6809;$(SolutionDir)\..\..\src\cpu\m68k;$(SolutionDir)\..\..\src\cpu\nec;$(SolutionDir)\..\..\src\cpu\s2650;$(SolutionDir)\..\..\src\cpu\sh2;$(SolutionDir)\..\..\src\cpu\z80;$(SolutionDir)\..\..\src\intf\input;$(SolutionDir)\..\..\src\intf;$(SolutionDir)\..\..\src\dep\libs\zlib;$(SolutionDir)\..\..\src\intf\cd true true @@ -845,7 +852,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;LTCG;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static + NDEBUG;_XBOX;_XBOX360;LTCG;_LIB;%(PreprocessorDefinitions);USE_SPEEDHACKS;__LIBRETRO__;INLINE=__inline static;EXTERNAL_ZLIB;__fastcall=;MAME_INLINE=_inline static;MSB_FIRST;__LIBRETRO_OPTIMIZATIONS__;FRONTEND_SUPPORTS_RGB565 $(SolutionDir)\..\..\src\burn\drv\taito;$(SolutionDir)\..\..\src\dep\generated;$(SolutionDir)\..\..\src\burner\libretro;$(SolutionDir)\..\..\src\burner;$(SolutionDir)\..\..\src\burn;$(SolutionDir)\..\..\src\burn\drv\pgm;$(SolutionDir)\..\..\src\burn\devices;$(SolutionDir)\..\..\src\burn\snd;$(SolutionDir)\..\..\src\cpu\;$(SolutionDir)\..\..\src\cpu\arm;$(SolutionDir)\..\..\src\cpu\arm7;$(SolutionDir)\..\..\src\cpu\h6280;$(SolutionDir)\..\..\src\cpu\hd6309;$(SolutionDir)\..\..\src\cpu\i8039;$(SolutionDir)\..\..\src\cpu\konami;$(SolutionDir)\..\..\src\cpu\m6502;$(SolutionDir)\..\..\src\cpu\m6800;$(SolutionDir)\..\..\src\cpu\m6805;$(SolutionDir)\..\..\src\cpu\m6809;$(SolutionDir)\..\..\src\cpu\m68k;$(SolutionDir)\..\..\src\cpu\nec;$(SolutionDir)\..\..\src\cpu\s2650;$(SolutionDir)\..\..\src\cpu\sh2;$(SolutionDir)\..\..\src\cpu\z80;$(SolutionDir)\..\..\src\intf\input;$(SolutionDir)\..\..\src\intf;$(SolutionDir)\..\..\src\dep\libs\zlib;$(SolutionDir)\..\..\src\intf\cd true diff --git a/projectfiles/visualstudio-2010-libretro-360/fba_vs2010_libretro_360.vcxproj.filters b/projectfiles/visualstudio-2010-libretro-360/fba_vs2010_libretro_360.vcxproj.filters index 63a9c57d1..ba2a5bacf 100644 --- a/projectfiles/visualstudio-2010-libretro-360/fba_vs2010_libretro_360.vcxproj.filters +++ b/projectfiles/visualstudio-2010-libretro-360/fba_vs2010_libretro_360.vcxproj.filters @@ -126,7 +126,7 @@ {aa239b2a-4448-46ed-aa06-51a84303473a} - + {7f4ef354-8a73-47f9-9c04-9924b98358ff} @@ -1367,9 +1367,6 @@ Source Files\cpu\m6502 - - Source Files\cpu - Source Files\cpu @@ -1400,12 +1397,6 @@ Source Files\cpu - - Source Files\cpu - - - Source Files\cpu - Source Files\burn @@ -1571,7 +1562,7 @@ Source Files\cpu\m68k - + Source Files\burner\libretro @@ -1586,5 +1577,35 @@ Source Files\burn\drv\pst90s + + Source Files\burn\drv\pre90s + + + Source Files\burn\drv\pre90s + + + Source Files\burn\drv\pre90s + + + Source Files\cpu + + + Source Files\cpu + + + Source Files\cpu + + + Source Files\burn\snd + + + Source Files\burn\drv\konami + + + Source Files\burn\devices + + + Source Files\burn\devices + \ No newline at end of file diff --git a/src/burner/libretro/burn_libretro_opts.h b/src/burner/libretro/burn_libretro_opts.h index 1a669225f..7c740c1e6 100644 --- a/src/burner/libretro/burn_libretro_opts.h +++ b/src/burner/libretro/burn_libretro_opts.h @@ -2,13 +2,16 @@ #define _LIBRETRO_OPTIMIZATIONS_H_ #define BurnHighCol LIBRETRO_COLOR_CONVERT +#define BurnHighColSwitch LIBRETRO_COLOR_CONVERT_SWITCH #ifdef FRONTEND_SUPPORTS_RGB565 #define LIBRETRO_COLOR_15BPP_XBGR(color, unused) (((color & 0x001f) << 11) | ((color & 0x03e0) << 1) | ((color & 0x7c00) >> 10)) #define LIBRETRO_COLOR_CONVERT(r, g, b, a) (((r << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((b >> 3) & 0x001f)) +#define LIBRETRO_COLOR_CONVERT_SWITCH(r, g, b, a) (nBurnBpp == 2) ? (((r << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((b >> 3) & 0x001f)) : (((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | ((b) & 0x0000ff)) #else #define LIBRETRO_COLOR_15BPP_XBGR(color, unused) ((((color & 0x1f) << 10) | (((color & 0x3e0) >> 5) << 5) | (((color & 0x7c00) >> 10))) & 0x7fff) #define LIBRETRO_COLOR_CONVERT(r, g, b, a) (((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) & 0x001f)) +#define LIBRETRO_COLOR_CONVERT_SWITCH(r, g, b, a) (nBurnBpp == 2) ? (((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) & 0x001f)) : (((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | ((b) & 0x0000ff)) #endif #endif diff --git a/src/burner/libretro/libretro.cpp b/src/burner/libretro/libretro.cpp index 70304d47f..7d6551fd7 100644 --- a/src/burner/libretro/libretro.cpp +++ b/src/burner/libretro/libretro.cpp @@ -34,7 +34,7 @@ static unsigned g_rom_count; #define AUDIO_SAMPLERATE 32000 #define AUDIO_SEGMENT_LENGTH 534 // <-- Hardcoded value that corresponds well to 32kHz audio. -static uint16_t g_fba_frame[1024 * 1024]; +static uint32_t g_fba_frame[1024 * 1024]; static int16_t g_audio_buf[AUDIO_SEGMENT_LENGTH * 2]; // libretro globals @@ -306,7 +306,7 @@ static bool open_archive() fprintf(stderr, "[FBA] ROM index %i was not found ... CRC: 0x%08x\n", i, g_find_list[i].ri.nCrc); if(!(g_find_list[i].ri.nType & BRF_OPT)) - return false; + return false; } } @@ -338,7 +338,7 @@ void retro_run() poll_input(); - nBurnLayer = 0xff; + //nBurnLayer = 0xff; pBurnSoundOut = g_audio_buf; nBurnSoundRate = AUDIO_SAMPLERATE; //nBurnSoundLen = AUDIO_SEGMENT_LENGTH; @@ -348,14 +348,15 @@ void retro_run() BurnDrvFrame(); unsigned drv_flags = BurnDrvGetFlags(); uint32_t height_tmp = height; + size_t pitch_size = nBurnBpp == 2 ? sizeof(uint16_t) : sizeof(uint32_t); if (drv_flags & (BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED)) { - nBurnPitch = height * sizeof(uint16_t); + nBurnPitch = height * pitch_size; height = width; width = height_tmp; } else - nBurnPitch = width * sizeof(uint16_t); + nBurnPitch = width * pitch_size; video_cb(g_fba_frame, width, height, nBurnPitch); audio_batch_cb(g_audio_buf, nBurnSoundLen); @@ -435,13 +436,19 @@ void retro_get_system_av_info(struct retro_system_av_info *info) info->timing = timing; } -static bool fba_init(unsigned driver) +int VidRecalcPal() +{ + return BurnRecalcPal(); +} + +static bool fba_init(unsigned driver, const char *game_zip_name) { nBurnDrvActive = driver; if (!open_archive()) return false; + nBurnBpp = 2; nFMInterpolation = 3; nInterpolation = 3; @@ -450,10 +457,11 @@ static bool fba_init(unsigned driver) int width, height; BurnDrvGetVisibleSize(&width, &height); unsigned drv_flags = BurnDrvGetFlags(); + size_t pitch_size = nBurnBpp == 2 ? sizeof(uint16_t) : sizeof(uint32_t); if (drv_flags & BDF_ORIENTATION_VERTICAL) - nBurnPitch = height * sizeof(uint16_t); + nBurnPitch = height * pitch_size; else - nBurnPitch = width * sizeof(uint16_t); + nBurnPitch = width * pitch_size; unsigned rotation; switch (drv_flags & (BDF_ORIENTATION_FLIPPED | BDF_ORIENTATION_VERTICAL)) @@ -474,8 +482,47 @@ static bool fba_init(unsigned driver) rotation = 0; } + if( + (strcmp("gunbird2", game_zip_name) == 0) || + (strcmp("s1945ii", game_zip_name) == 0) || + (strcmp("s1945iii", game_zip_name) == 0) || + (strcmp("dragnblz", game_zip_name) == 0) || + (strcmp("gnbarich", game_zip_name) == 0) || + (strcmp("mjgtaste", game_zip_name) == 0) || + (strcmp("tgm2", game_zip_name) == 0) || + (strcmp("tgm2p", game_zip_name) == 0) || + (strcmp("soldivid", game_zip_name) == 0) || + (strcmp("daraku", game_zip_name) == 0) || + (strcmp("sbomber", game_zip_name) == 0) || + (strcmp("sbombera", game_zip_name) == 0) + + ) + { + nBurnBpp = 4; + } + fprintf(stderr, "Game: %s\n", game_zip_name); + environ_cb(RETRO_ENVIRONMENT_SET_ROTATION, &rotation); + VidRecalcPal(); + +#ifdef FRONTEND_SUPPORTS_RGB565 + if(nBurnBpp == 4) + { + enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888; + + if(environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) + fprintf(stderr, "Frontend supports XRGB888 - will use that instead of XRGB1555.\n"); + } + else + { + enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; + + if(environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) + fprintf(stderr, "Frontend supports RGB565 - will use that instead of XRGB1555.\n"); + } +#endif + return true; } @@ -491,10 +538,6 @@ static unsigned int HighCol15(int r, int g, int b, int /* i */) } #endif -int VidRecalcPal() -{ - return BurnRecalcPal(); -} static void init_video() { @@ -546,13 +589,11 @@ bool retro_load_game(const struct retro_game_info *info) unsigned i = BurnDrvGetIndexByName(basename); if (i < nBurnDrvCount) { - nBurnBpp = 2; - VidRecalcPal(); pBurnSoundOut = g_audio_buf; nBurnSoundRate = AUDIO_SAMPLERATE; nBurnSoundLen = AUDIO_SEGMENT_LENGTH; - if (!fba_init(i)) + if (!fba_init(i, basename)) return false; driver_inited = true; @@ -563,11 +604,6 @@ bool retro_load_game(const struct retro_game_info *info) else fprintf(stderr, "[FBA] Cannot find driver.\n"); -#ifdef FRONTEND_SUPPORTS_RGB565 - enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; - if(environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) - fprintf(stderr, "Frontend supports RGB565 - will use that instead of XRGB1555.\n"); -#endif return retval; } @@ -594,11 +630,69 @@ struct key_map unsigned nCode[2]; }; static uint8_t keybinds[0x5000][2]; -#define _BIND(x) RETRO_DEVICE_ID_JOYPAD_##x -#define RESET_BIND 12 -#define SERVICE_BIND 13 -#define BIND_MAP_COUNT 145 +//#define BIND_MAP_COUNT 151 +#define BIND_MAP_COUNT 149 + +#define RETRO_DEVICE_ID_JOYPAD_RESET 16 +#define RETRO_DEVICE_ID_JOYPAD_SERVICE 17 +#define RETRO_DEVICE_ID_JOYPAD_DIAGNOSTIC 18 +#define RETRO_DEVICE_ID_JOYPAD_DIP_A 19 +#define RETRO_DEVICE_ID_JOYPAD_DIP_B 20 +#define RETRO_DEVICE_ID_JOYPAD_TEST 21 + +static const char *print_label(unsigned i) +{ + switch(i) + { + case RETRO_DEVICE_ID_JOYPAD_B: + return "RetroPad Button B"; + case RETRO_DEVICE_ID_JOYPAD_Y: + return "RetroPad Button Y"; + case RETRO_DEVICE_ID_JOYPAD_SELECT: + return "RetroPad Button Select"; + case RETRO_DEVICE_ID_JOYPAD_START: + return "RetroPad Button Start"; + case RETRO_DEVICE_ID_JOYPAD_UP: + return "RetroPad D-Pad Up"; + case RETRO_DEVICE_ID_JOYPAD_DOWN: + return "RetroPad D-Pad Down"; + case RETRO_DEVICE_ID_JOYPAD_LEFT: + return "RetroPad D-Pad Left"; + case RETRO_DEVICE_ID_JOYPAD_RIGHT: + return "RetroPad D-Pad Right"; + case RETRO_DEVICE_ID_JOYPAD_A: + return "RetroPad Button A"; + case RETRO_DEVICE_ID_JOYPAD_X: + return "RetroPad Button X"; + case RETRO_DEVICE_ID_JOYPAD_L: + return "RetroPad Button L"; + case RETRO_DEVICE_ID_JOYPAD_R: + return "RetroPad Button R"; + case RETRO_DEVICE_ID_JOYPAD_L2: + return "RetroPad Button L2"; + case RETRO_DEVICE_ID_JOYPAD_R2: + return "RetroPad Button R2"; + case RETRO_DEVICE_ID_JOYPAD_L3: + return "RetroPad Button L3"; + case RETRO_DEVICE_ID_JOYPAD_R3: + return "RetroPad Button R3"; + case RETRO_DEVICE_ID_JOYPAD_RESET: + return "RetroPad Reset"; + case RETRO_DEVICE_ID_JOYPAD_SERVICE: + return "RetroPad Service"; + case RETRO_DEVICE_ID_JOYPAD_DIAGNOSTIC: + return "RetroPad Diagnostic"; + case RETRO_DEVICE_ID_JOYPAD_DIP_A: + return "RetroPad DIP A"; + case RETRO_DEVICE_ID_JOYPAD_DIP_B: + return "RetroPad DIP B"; + case RETRO_DEVICE_ID_JOYPAD_TEST: + return "RetroPad Test"; + default: + return "No known label"; + } +} static bool init_input() { @@ -643,620 +737,636 @@ static bool init_input() key_map bind_map[BIND_MAP_COUNT]; bind_map[0].bii_name = "P1 Coin"; - bind_map[0].nCode[0] = _BIND(SELECT); + bind_map[0].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[0].nCode[1] = 0; bind_map[1].bii_name = "P1 Start"; - bind_map[1].nCode[0] = _BIND(START); + bind_map[1].nCode[0] = RETRO_DEVICE_ID_JOYPAD_START; bind_map[1].nCode[1] = 0; bind_map[2].bii_name = "Start 1"; - bind_map[2].nCode[0] = _BIND(START); + bind_map[2].nCode[0] = RETRO_DEVICE_ID_JOYPAD_START; bind_map[2].nCode[1] = 0; bind_map[3].bii_name = "P1 Up"; - bind_map[3].nCode[0] = _BIND(UP); + bind_map[3].nCode[0] = RETRO_DEVICE_ID_JOYPAD_UP; bind_map[3].nCode[1] = 0; bind_map[4].bii_name = "P1 Down"; - bind_map[4].nCode[0] = _BIND(DOWN); + bind_map[4].nCode[0] = RETRO_DEVICE_ID_JOYPAD_DOWN; bind_map[4].nCode[1] = 0; bind_map[5].bii_name = "P1 Left"; - bind_map[5].nCode[0] = _BIND(LEFT); + bind_map[5].nCode[0] = RETRO_DEVICE_ID_JOYPAD_LEFT; bind_map[5].nCode[1] = 0; bind_map[6].bii_name = "P1 Right"; - bind_map[6].nCode[0] = _BIND(RIGHT); + bind_map[6].nCode[0] = RETRO_DEVICE_ID_JOYPAD_RIGHT; bind_map[6].nCode[1] = 0; bind_map[7].bii_name = "P1 Attack"; - bind_map[7].nCode[0] = _BIND(Y); + bind_map[7].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[7].nCode[1] = 0; bind_map[8].bii_name = "Accelerate"; - bind_map[8].nCode[0] = _BIND(B); + bind_map[8].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[8].nCode[1] = 0; bind_map[9].bii_name = "Brake"; - bind_map[9].nCode[0] = _BIND(Y); + bind_map[9].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[9].nCode[1] = 0; bind_map[10].bii_name = "Gear"; - bind_map[10].nCode[0] = _BIND(A); + bind_map[10].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[10].nCode[1] = 0; /* for Forgotten Worlds, etc */ bind_map[11].bii_name = "P1 Turn"; - bind_map[11].nCode[0] = _BIND(A); + bind_map[11].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[11].nCode[1] = 0; bind_map[12].bii_name = "P1 Jump"; - bind_map[12].nCode[0] = _BIND(B); + bind_map[12].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[12].nCode[1] = 0; bind_map[13].bii_name = "P1 Pin"; - bind_map[13].nCode[0] = _BIND(A); + bind_map[13].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[13].nCode[1] = 0; bind_map[14].bii_name = "P1 Select"; - bind_map[14].nCode[0] = _BIND(A); + bind_map[14].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[14].nCode[1] = 0; bind_map[15].bii_name = "P1 Use"; - bind_map[15].nCode[0] = _BIND(X); + bind_map[15].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[15].nCode[1] = 0; bind_map[16].bii_name = "P1 Weak Punch"; - bind_map[16].nCode[0] = _BIND(Y); + bind_map[16].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[16].nCode[1] = 0; bind_map[17].bii_name = "P1 Medium Punch"; - bind_map[17].nCode[0] = _BIND(X); + bind_map[17].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[17].nCode[1] = 0; bind_map[18].bii_name = "P1 Strong Punch"; - bind_map[18].nCode[0] = _BIND(L); + bind_map[18].nCode[0] = RETRO_DEVICE_ID_JOYPAD_L; bind_map[18].nCode[1] = 0; bind_map[19].bii_name = "P1 Weak Kick"; - bind_map[19].nCode[0] = _BIND(B); + bind_map[19].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[19].nCode[1] = 0; bind_map[20].bii_name = "P1 Medium Kick"; - bind_map[20].nCode[0] = _BIND(A); + bind_map[20].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[20].nCode[1] = 0; bind_map[21].bii_name = "P1 Strong Kick"; - bind_map[21].nCode[0] = _BIND(R); + bind_map[21].nCode[0] = RETRO_DEVICE_ID_JOYPAD_R; bind_map[21].nCode[1] = 0; bind_map[22].bii_name = "P1 Rotate Left"; - bind_map[22].nCode[0] = _BIND(B); + bind_map[22].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[22].nCode[1] = 0; bind_map[23].bii_name = "P1 Rotate Right"; - bind_map[23].nCode[0] = _BIND(A); + bind_map[23].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[23].nCode[1] = 0; bind_map[24].bii_name = "P1 Punch"; - bind_map[24].nCode[0] = _BIND(Y); + bind_map[24].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[24].nCode[1] = 0; bind_map[25].bii_name = "P1 Kick"; - bind_map[25].nCode[0] = _BIND(B); + bind_map[25].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[25].nCode[1] = 0; bind_map[26].bii_name = "P1 Special"; - bind_map[26].nCode[0] = _BIND(A); + bind_map[26].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[26].nCode[1] = 0; bind_map[27].bii_name = "P1 Shot"; - bind_map[27].nCode[0] = _BIND(B); + bind_map[27].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[27].nCode[1] = 0; bind_map[28].bii_name = "P1 Shot (auto)"; - bind_map[28].nCode[0] = _BIND(X); + bind_map[28].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[28].nCode[1] = 0; /* Simpsons - Konami */ bind_map[29].bii_name = "P1 Button 1"; - bind_map[29].nCode[0] = _BIND(Y); + bind_map[29].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[29].nCode[1] = 0; /* Simpsons - Konami */ bind_map[30].bii_name = "P1 Button 2"; - bind_map[30].nCode[0] = _BIND(B); + bind_map[30].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[30].nCode[1] = 0; bind_map[31].bii_name = "P1 Button 3"; - bind_map[31].nCode[0] = _BIND(A); + bind_map[31].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[31].nCode[1] = 0; bind_map[32].bii_name = "P1 Button 4"; - bind_map[32].nCode[0] = _BIND(X); + bind_map[32].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[32].nCode[1] = 0; /* Progear */ bind_map[33].bii_name = "P1 Auto"; - bind_map[33].nCode[0] = _BIND(A); + bind_map[33].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[33].nCode[1] = 0; /* Punisher */ bind_map[34].bii_name = "P1 Super"; - bind_map[34].nCode[0] = _BIND(A); + bind_map[34].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[34].nCode[1] = 0; bind_map[35].bii_name = "P1 Answer 1"; - bind_map[35].nCode[0] = _BIND(Y); + bind_map[35].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[35].nCode[1] = 0; bind_map[36].bii_name = "P1 Answer 2"; - bind_map[36].nCode[0] = _BIND(X); + bind_map[36].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[36].nCode[1] = 0; bind_map[37].bii_name = "P1 Answer 3"; - bind_map[37].nCode[0] = _BIND(B); + bind_map[37].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[37].nCode[1] = 0; bind_map[38].bii_name = "P1 Answer 4"; - bind_map[38].nCode[0] = _BIND(A); + bind_map[38].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[38].nCode[1] = 0; bind_map[39].bii_name = "P1 Shot 1"; - bind_map[39].nCode[0] = _BIND(B); + bind_map[39].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[39].nCode[1] = 0; /* Pang 3 */ bind_map[40].bii_name = "P1 Shot 1"; - bind_map[40].nCode[0] = _BIND(B); + bind_map[40].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[40].nCode[1] = 0; /* Pang 3 */ bind_map[41].bii_name = "P1 Shot 2"; - bind_map[41].nCode[0] = _BIND(A); + bind_map[41].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[41].nCode[1] = 0; bind_map[42].bii_name = "P1 Bomb"; - bind_map[42].nCode[0] = _BIND(A); + bind_map[42].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[42].nCode[1] = 0; bind_map[43].bii_name = "P1 Special"; - bind_map[43].nCode[0] = _BIND(A); + bind_map[43].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[43].nCode[1] = 0; /* for Ghouls 'n Ghosts */ bind_map[44].bii_name = "P1 Fire"; - bind_map[44].nCode[0] = _BIND(Y); + bind_map[44].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[44].nCode[1] = 0; /* TMNT */ bind_map[45].bii_name = "P1 Fire 1"; - bind_map[45].nCode[0] = _BIND(Y); + bind_map[45].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[45].nCode[1] = 0; /* Space Harrier */ bind_map[46].bii_name = "Fire 1"; - bind_map[46].nCode[0] = _BIND(Y); + bind_map[46].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[46].nCode[1] = 0; /* Space Harrier */ bind_map[47].bii_name = "Fire 2"; - bind_map[47].nCode[0] = _BIND(B); + bind_map[47].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[47].nCode[1] = 0; /* Space Harrier */ bind_map[48].bii_name = "Fire 3"; - bind_map[48].nCode[0] = _BIND(A); + bind_map[48].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[48].nCode[1] = 0; /* TMNT */ bind_map[49].bii_name = "P1 Fire 2"; - bind_map[49].nCode[0] = _BIND(B); + bind_map[49].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[49].nCode[1] = 0; /* Strider */ bind_map[50].bii_name = "P1 Fire 3"; - bind_map[50].nCode[0] = _BIND(A); + bind_map[50].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[50].nCode[1] = 0; /* Strider */ bind_map[51].bii_name = "Coin 1"; - bind_map[51].nCode[0] = _BIND(SELECT); + bind_map[51].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[51].nCode[1] = 0; /* Neo Geo */ bind_map[52].bii_name = "P1 Button A"; - bind_map[52].nCode[0] = _BIND(B); + bind_map[52].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[52].nCode[1] = 0; /* Neo Geo */ bind_map[53].bii_name = "P1 Button B"; - bind_map[53].nCode[0] = _BIND(A); + bind_map[53].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[53].nCode[1] = 0; /* Neo Geo */ bind_map[54].bii_name = "P1 Button C"; - bind_map[54].nCode[0] = _BIND(Y); + bind_map[54].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[54].nCode[1] = 0; /* Neo Geo */ bind_map[55].bii_name = "P1 Button D"; - bind_map[55].nCode[0] = _BIND(X); + bind_map[55].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[55].nCode[1] = 0; bind_map[56].bii_name = "P2 Coin"; - bind_map[56].nCode[0] = _BIND(SELECT); + bind_map[56].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[56].nCode[1] = 1; bind_map[57].bii_name = "P2 Start"; - bind_map[57].nCode[0] = _BIND(START); + bind_map[57].nCode[0] = RETRO_DEVICE_ID_JOYPAD_START; bind_map[57].nCode[1] = 1; bind_map[58].bii_name = "P2 Up"; - bind_map[58].nCode[0] = _BIND(UP); + bind_map[58].nCode[0] = RETRO_DEVICE_ID_JOYPAD_UP; bind_map[58].nCode[1] = 1; bind_map[59].bii_name = "P2 Down"; - bind_map[59].nCode[0] = _BIND(DOWN); + bind_map[59].nCode[0] = RETRO_DEVICE_ID_JOYPAD_DOWN; bind_map[59].nCode[1] = 1; bind_map[60].bii_name = "P2 Left"; - bind_map[60].nCode[0] = _BIND(LEFT); + bind_map[60].nCode[0] = RETRO_DEVICE_ID_JOYPAD_LEFT; bind_map[60].nCode[1] = 1; bind_map[61].bii_name = "P2 Right"; - bind_map[61].nCode[0] = _BIND(RIGHT); + bind_map[61].nCode[0] = RETRO_DEVICE_ID_JOYPAD_RIGHT; bind_map[61].nCode[1] = 1; bind_map[62].bii_name = "P2 Attack"; - bind_map[62].nCode[0] = _BIND(Y); + bind_map[62].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[62].nCode[1] = 1; // for Forgotten Worlds, etc. bind_map[63].bii_name = "P2 Turn"; - bind_map[63].nCode[0] = _BIND(A); + bind_map[63].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[63].nCode[1] = 1; bind_map[64].bii_name = "P2 Jump"; - bind_map[64].nCode[0] = _BIND(B); + bind_map[64].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[64].nCode[1] = 1; bind_map[65].bii_name = "P2 Pin"; - bind_map[65].nCode[0] = _BIND(A); + bind_map[65].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[65].nCode[1] = 1; bind_map[66].bii_name = "P2 Select"; - bind_map[66].nCode[0] = _BIND(A); + bind_map[66].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[66].nCode[1] = 1; bind_map[67].bii_name = "P2 Use"; - bind_map[67].nCode[0] = _BIND(X); + bind_map[67].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[67].nCode[1] = 1; bind_map[68].bii_name = "P2 Weak Punch"; - bind_map[68].nCode[0] = _BIND(Y); + bind_map[68].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[68].nCode[1] = 1; bind_map[69].bii_name = "P2 Medium Punch"; - bind_map[69].nCode[0] = _BIND(X); + bind_map[69].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[69].nCode[1] = 1; bind_map[70].bii_name = "P2 Strong Punch"; - bind_map[70].nCode[0] = _BIND(L); + bind_map[70].nCode[0] = RETRO_DEVICE_ID_JOYPAD_L; bind_map[70].nCode[1] = 1; bind_map[71].bii_name = "P2 Weak Kick"; - bind_map[71].nCode[0] = _BIND(B); + bind_map[71].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[71].nCode[1] = 1; bind_map[72].bii_name = "P2 Medium Kick"; - bind_map[72].nCode[0] = _BIND(A); + bind_map[72].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[72].nCode[1] = 1; bind_map[73].bii_name = "P2 Strong Kick"; - bind_map[73].nCode[0] = _BIND(R); + bind_map[73].nCode[0] = RETRO_DEVICE_ID_JOYPAD_R; bind_map[73].nCode[1] = 1; bind_map[74].bii_name = "P2 Rotate Left"; - bind_map[74].nCode[0] = _BIND(B); + bind_map[74].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[74].nCode[1] = 1; bind_map[75].bii_name = "P2 Rotate Right"; - bind_map[75].nCode[0] = _BIND(A); + bind_map[75].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[75].nCode[1] = 1; bind_map[76].bii_name = "P2 Punch"; - bind_map[76].nCode[0] = _BIND(Y); + bind_map[76].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[76].nCode[1] = 1; bind_map[77].bii_name = "P2 Kick"; - bind_map[77].nCode[0] = _BIND(B); + bind_map[77].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[77].nCode[1] = 1; bind_map[78].bii_name = "P2 Special"; - bind_map[78].nCode[0] = _BIND(A); + bind_map[78].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[78].nCode[1] = 1; bind_map[79].bii_name = "P2 Shot"; - bind_map[79].nCode[0] = _BIND(B); + bind_map[79].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[79].nCode[1] = 1; /* Simpsons - Konami */ bind_map[80].bii_name = "P2 Button 1"; - bind_map[80].nCode[0] = _BIND(Y); + bind_map[80].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[80].nCode[1] = 1; bind_map[81].bii_name = "P2 Button 2"; - bind_map[81].nCode[0] = _BIND(B); + bind_map[81].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[81].nCode[1] = 1; /* Various */ bind_map[82].bii_name = "P2 Button 3"; - bind_map[82].nCode[0] = _BIND(A); + bind_map[82].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[82].nCode[1] = 1; bind_map[83].bii_name = "P2 Button 4"; - bind_map[83].nCode[0] = _BIND(X); + bind_map[83].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[83].nCode[1] = 1; /* Progear */ bind_map[84].bii_name = "P2 Auto"; - bind_map[84].nCode[0] = _BIND(A); + bind_map[84].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[84].nCode[1] = 1; bind_map[85].bii_name = "P2 Shot (auto)"; - bind_map[85].nCode[0] = _BIND(X); + bind_map[85].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[85].nCode[1] = 1; /* Punisher */ bind_map[86].bii_name = "P2 Super"; - bind_map[86].nCode[0] = _BIND(A); + bind_map[86].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[86].nCode[1] = 1; bind_map[87].bii_name = "P2 Answer 1"; - bind_map[87].nCode[0] = _BIND(Y); + bind_map[87].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[87].nCode[1] = 1; bind_map[88].bii_name = "P2 Answer 2"; - bind_map[88].nCode[0] = _BIND(X); + bind_map[88].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[88].nCode[1] = 1; bind_map[89].bii_name = "P2 Answer 3"; - bind_map[89].nCode[0] = _BIND(B); + bind_map[89].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[89].nCode[1] = 1; bind_map[90].bii_name = "P2 Answer 4"; - bind_map[90].nCode[0] = _BIND(A); + bind_map[90].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[90].nCode[1] = 1; /* Pang 3 */ bind_map[91].bii_name = "P2 Shot 1"; - bind_map[91].nCode[0] = _BIND(B); + bind_map[91].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[91].nCode[1] = 1; bind_map[92].bii_name = "P2 Shot 2"; - bind_map[92].nCode[0] = _BIND(A); + bind_map[92].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[92].nCode[1] = 1; bind_map[93].bii_name = "P2 Bomb"; - bind_map[93].nCode[0] = _BIND(A); + bind_map[93].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[93].nCode[1] = 1; bind_map[94].bii_name = "P2 Special"; - bind_map[94].nCode[0] = _BIND(A); + bind_map[94].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[94].nCode[1] = 1; /* Ghouls 'n Ghosts */ bind_map[95].bii_name = "P2 Fire"; - bind_map[95].nCode[0] = _BIND(Y); + bind_map[95].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[95].nCode[1] = 1; /* TMNT */ bind_map[96].bii_name = "P2 Fire 1"; - bind_map[96].nCode[0] = _BIND(Y); + bind_map[96].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[96].nCode[1] = 1; bind_map[97].bii_name = "P2 Fire 2"; - bind_map[97].nCode[0] = _BIND(B); + bind_map[97].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[97].nCode[1] = 1; /* Strider */ bind_map[98].bii_name = "P2 Fire 3"; - bind_map[98].nCode[0] = _BIND(A); + bind_map[98].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[98].nCode[1] = 1; bind_map[99].bii_name = "Coin 2"; - bind_map[99].nCode[0] = _BIND(SELECT); + bind_map[99].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[99].nCode[1] = 1; /* Neo Geo */ bind_map[100].bii_name = "P2 Button A"; - bind_map[100].nCode[0] = _BIND(B); + bind_map[100].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[100].nCode[1] = 1; bind_map[101].bii_name = "P2 Button B"; - bind_map[101].nCode[0] = _BIND(A); + bind_map[101].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[101].nCode[1] = 1; bind_map[102].bii_name = "P2 Button C"; - bind_map[102].nCode[0] = _BIND(Y); + bind_map[102].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[102].nCode[1] = 1; bind_map[103].bii_name = "P2 Button D"; - bind_map[103].nCode[0] = _BIND(X); + bind_map[103].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[103].nCode[1] = 1; bind_map[104].bii_name = "P3 Coin"; - bind_map[104].nCode[0] = _BIND(SELECT); + bind_map[104].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[104].nCode[1] = 2; bind_map[105].bii_name = "P3 Start"; - bind_map[105].nCode[0] = _BIND(START); + bind_map[105].nCode[0] = RETRO_DEVICE_ID_JOYPAD_START; bind_map[105].nCode[1] = 2; bind_map[106].bii_name = "P3 Up"; - bind_map[106].nCode[0] = _BIND(UP); + bind_map[106].nCode[0] = RETRO_DEVICE_ID_JOYPAD_UP; bind_map[106].nCode[1] = 2; bind_map[107].bii_name = "P3 Down"; - bind_map[107].nCode[0] = _BIND(DOWN); + bind_map[107].nCode[0] = RETRO_DEVICE_ID_JOYPAD_DOWN; bind_map[107].nCode[1] = 2; bind_map[108].bii_name = "P3 Left"; - bind_map[108].nCode[0] = _BIND(LEFT); + bind_map[108].nCode[0] = RETRO_DEVICE_ID_JOYPAD_LEFT; bind_map[108].nCode[1] = 2; bind_map[109].bii_name = "P3 Right"; - bind_map[109].nCode[0] = _BIND(RIGHT); + bind_map[109].nCode[0] = RETRO_DEVICE_ID_JOYPAD_RIGHT; bind_map[109].nCode[1] = 2; bind_map[110].bii_name = "P3 Attack"; - bind_map[110].nCode[0] = _BIND(Y); + bind_map[110].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[110].nCode[1] = 2; bind_map[111].bii_name = "P3 Jump"; - bind_map[111].nCode[0] = _BIND(B); + bind_map[111].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[111].nCode[1] = 2; bind_map[112].bii_name = "P3 Pin"; - bind_map[112].nCode[0] = _BIND(A); + bind_map[112].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[112].nCode[1] = 2; bind_map[113].bii_name = "P3 Select"; - bind_map[113].nCode[0] = _BIND(A); + bind_map[113].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[113].nCode[1] = 2; bind_map[114].bii_name = "P3 Use"; - bind_map[114].nCode[0] = _BIND(X); + bind_map[114].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[114].nCode[1] = 2; /* Simpsons - Konami */ bind_map[115].bii_name = "P3 Button 1"; - bind_map[115].nCode[0] = _BIND(Y); + bind_map[115].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[115].nCode[1] = 2; bind_map[116].bii_name = "P3 Button 2"; - bind_map[116].nCode[0] = _BIND(B); + bind_map[116].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[116].nCode[1] = 2; bind_map[117].bii_name = "P3 Button 3"; - bind_map[117].nCode[0] = _BIND(A); + bind_map[117].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[117].nCode[1] = 2; bind_map[118].bii_name = "P3 Button 4"; - bind_map[118].nCode[0] = _BIND(X); + bind_map[118].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[118].nCode[1] = 2; /* TMNT */ bind_map[119].bii_name = "P3 Fire 1"; - bind_map[119].nCode[0] = _BIND(Y); + bind_map[119].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[119].nCode[1] = 2; bind_map[120].bii_name = "P3 Fire 2"; - bind_map[120].nCode[0] = _BIND(B); + bind_map[120].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[120].nCode[1] = 2; /* Strider */ bind_map[121].bii_name = "P3 Fire 3"; - bind_map[121].nCode[0] = _BIND(A); + bind_map[121].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[121].nCode[1] = 2; bind_map[122].bii_name = "Coin 3"; - bind_map[122].nCode[0] = _BIND(SELECT); + bind_map[122].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[122].nCode[1] = 2; bind_map[123].bii_name = "P4 Coin"; - bind_map[123].nCode[0] = _BIND(SELECT); + bind_map[123].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[123].nCode[1] = 3; bind_map[124].bii_name = "P4 Start"; - bind_map[124].nCode[0] = _BIND(START); + bind_map[124].nCode[0] = RETRO_DEVICE_ID_JOYPAD_START; bind_map[124].nCode[1] = 3; bind_map[125].bii_name = "P4 Up"; - bind_map[125].nCode[0] = _BIND(UP); + bind_map[125].nCode[0] = RETRO_DEVICE_ID_JOYPAD_UP; bind_map[125].nCode[1] = 3; bind_map[126].bii_name = "P4 Down"; - bind_map[126].nCode[0] = _BIND(DOWN); + bind_map[126].nCode[0] = RETRO_DEVICE_ID_JOYPAD_DOWN; bind_map[126].nCode[1] = 3; bind_map[127].bii_name = "P4 Left"; - bind_map[127].nCode[0] = _BIND(LEFT); + bind_map[127].nCode[0] = RETRO_DEVICE_ID_JOYPAD_LEFT; bind_map[127].nCode[1] = 3; bind_map[128].bii_name = "P4 Right"; - bind_map[128].nCode[0] = _BIND(RIGHT); + bind_map[128].nCode[0] = RETRO_DEVICE_ID_JOYPAD_RIGHT; bind_map[128].nCode[1] = 3; bind_map[129].bii_name = "P4 Attack"; - bind_map[129].nCode[0] = _BIND(Y); + bind_map[129].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[129].nCode[1] = 3; bind_map[130].bii_name = "P4 Jump"; - bind_map[130].nCode[0] = _BIND(B); + bind_map[130].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[130].nCode[1] = 3; bind_map[131].bii_name = "P4 Pin"; - bind_map[131].nCode[0] = _BIND(A); + bind_map[131].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[131].nCode[1] = 3; bind_map[132].bii_name = "P4 Select"; - bind_map[132].nCode[0] = _BIND(A); + bind_map[132].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[132].nCode[1] = 3; bind_map[133].bii_name = "P4 Use"; - bind_map[133].nCode[0] = _BIND(X); + bind_map[133].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[133].nCode[1] = 3; /* Simpsons */ bind_map[134].bii_name = "P4 Button 1"; - bind_map[134].nCode[0] = _BIND(Y); + bind_map[134].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[134].nCode[1] = 3; bind_map[135].bii_name = "P4 Button 2"; - bind_map[135].nCode[0] = _BIND(B); + bind_map[135].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[135].nCode[1] = 3; bind_map[136].bii_name = "P4 Button 3"; - bind_map[136].nCode[0] = _BIND(A); + bind_map[136].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[136].nCode[1] = 3; bind_map[137].bii_name = "P4 Button 4"; - bind_map[137].nCode[0] = _BIND(X); + bind_map[137].nCode[0] = RETRO_DEVICE_ID_JOYPAD_X; bind_map[137].nCode[1] = 3; /* TMNT */ bind_map[138].bii_name = "P4 Fire 1"; - bind_map[138].nCode[0] = _BIND(Y); + bind_map[138].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[138].nCode[1] = 3; bind_map[139].bii_name = "P4 Fire 2"; - bind_map[139].nCode[0] = _BIND(B); + bind_map[139].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[139].nCode[1] = 3; bind_map[140].bii_name = "P4 Fire 3"; - bind_map[140].nCode[0] = _BIND(A); + bind_map[140].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[140].nCode[1] = 3; bind_map[141].bii_name = "Coin 4"; - bind_map[141].nCode[0] = _BIND(SELECT); + bind_map[141].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SELECT; bind_map[141].nCode[1] = 3; bind_map[142].bii_name = "Missile"; - bind_map[142].nCode[0] = _BIND(A); + bind_map[142].nCode[0] = RETRO_DEVICE_ID_JOYPAD_A; bind_map[142].nCode[1] = 3; /* Afterburner */ bind_map[143].bii_name = "Vulcan"; - bind_map[143].nCode[0] = _BIND(B); + bind_map[143].nCode[0] = RETRO_DEVICE_ID_JOYPAD_B; bind_map[143].nCode[1] = 3; bind_map[144].bii_name = "Throttle"; - bind_map[144].nCode[0] = _BIND(Y); + bind_map[144].nCode[0] = RETRO_DEVICE_ID_JOYPAD_Y; bind_map[144].nCode[1] = 3; + bind_map[145].bii_name = "Reset"; + bind_map[145].nCode[0] = RETRO_DEVICE_ID_JOYPAD_RESET; + bind_map[145].nCode[1] = 0; + + bind_map[146].bii_name = "Service"; + bind_map[146].nCode[0] = RETRO_DEVICE_ID_JOYPAD_SERVICE; + bind_map[146].nCode[1] = 0; + + bind_map[147].bii_name = "Diagnostic"; + bind_map[147].nCode[0] = RETRO_DEVICE_ID_JOYPAD_DIAGNOSTIC; + bind_map[147].nCode[1] = 0; + + bind_map[148].bii_name = "Test"; + bind_map[148].nCode[0] = RETRO_DEVICE_ID_JOYPAD_TEST; + bind_map[148].nCode[1] = 0; + for(unsigned int i = 0; i < nGameInpCount; i++, pgi++) { /* TODO: Cyberbots: Full Metal Madness */ @@ -1268,25 +1378,25 @@ static bool init_input() { if((strcmp(bii.szName,"P1 Select") ==0) && (boardrom && (strcmp(boardrom,"neogeo") == 0))) { - keybinds[pgi->Input.Switch.nCode][0] = _BIND(SELECT); + keybinds[pgi->Input.Switch.nCode][0] = RETRO_DEVICE_ID_JOYPAD_SELECT; keybinds[pgi->Input.Switch.nCode][1] = 0; value_found = true; } else if((strcmp(bii.szName,"P1 Shot") ==0) && (parentrom && strcmp(parentrom,"avsp") == 0 || strcmp(drvname,"avsp") == 0)) { - keybinds[pgi->Input.Switch.nCode][0] = _BIND(A); + keybinds[pgi->Input.Switch.nCode][0] = RETRO_DEVICE_ID_JOYPAD_A; keybinds[pgi->Input.Switch.nCode][1] = 0; value_found = true; } else if((strcmp(bii.szName,"P2 Select") ==0) && (boardrom && (strcmp(boardrom,"neogeo") == 0))) { - keybinds[pgi->Input.Switch.nCode][0] = _BIND(SELECT); + keybinds[pgi->Input.Switch.nCode][0] = RETRO_DEVICE_ID_JOYPAD_SELECT; keybinds[pgi->Input.Switch.nCode][1] = 1; value_found = true; } else if((parentrom && strcmp(parentrom,"avsp") == 0 || strcmp(drvname,"avsp") == 0) && (strcmp(bii.szName,"P2 Shot") ==0)) { - keybinds[pgi->Input.Switch.nCode][0] = _BIND(A); + keybinds[pgi->Input.Switch.nCode][0] = RETRO_DEVICE_ID_JOYPAD_A; keybinds[pgi->Input.Switch.nCode][1] = 1; value_found = true; } @@ -1301,23 +1411,15 @@ static bool init_input() if(value_found) { - fprintf(stderr, "%s: %d.\n", bii.szName, pgi->Input.Switch.nCode ); + fprintf(stderr, "%s - assigned to key: %s, port: %d.\n", bii.szName, print_label(keybinds[pgi->Input.Switch.nCode][0]),keybinds[pgi->Input.Switch.nCode][1]); break; } } if(!value_found) - fprintf(stderr, "WARNING! Button accounted for: [%s].\n", bii.szName); + fprintf(stderr, "WARNING! Button unaccounted for: [%s].\n", bii.szName); } - // Reset - keybinds[FBK_F3 ][0] = RESET_BIND; - keybinds[FBK_F3 ][1] = 0; - - // Service - keybinds[FBK_F2 ][0] = SERVICE_BIND; - keybinds[FBK_F2 ][1] = 0; - return has_analog; } @@ -1349,10 +1451,12 @@ static inline int CinpJoyAxis(int i, int axis) case 7: return 0; } + return 0; } static inline int CinpMouseAxis(int i, int axis) { + return 0; } static inline int CinpState(int i) @@ -1377,9 +1481,9 @@ static void poll_input(void) if (pgi->nInput == GIT_KEYSLIDER) { // Get states of the two keys - if (input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(LEFT))) + if (input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT)) nAdd -= 0x100; - if (input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(RIGHT))) + if (input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT)) nAdd += 0x100; } @@ -1410,47 +1514,66 @@ static void poll_input(void) for (unsigned i = 0; i < controller_binds_count; i++, pgi++) { - if (pgi->Input.pVal == NULL) - continue; - switch (pgi->nInput) { - case 0: // Undefined - pgi->Input.nVal = 0; - break; case GIT_CONSTANT: // Constant value - pgi->Input.nVal = pgi->Input.Constant.nConst; -#ifdef LSB_FIRST - *(pgi->Input.pShortVal) = pgi->Input.nVal; -#else - *((int *)pgi->Input.pShortVal) = pgi->Input.nVal; -#endif + { + pgi->Input.nVal = pgi->Input.Constant.nConst; + *(pgi->Input.pShortVal) = pgi->Input.nVal; + } break; case GIT_SWITCH: { // Digital input - INT32 s = CinpState(pgi->Input.Switch.nCode); + INT32 id = keybinds[pgi->Input.Switch.nCode][0]; unsigned port = keybinds[pgi->Input.Switch.nCode][1]; - bool state; - if (s == RESET_BIND) + bool state = false; + + if (g_reset || id > 15) { - state = g_reset; - g_reset = false; - Reinitialise(); - } - else if (s == SERVICE_BIND) - { - state = - input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(START)) && - input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(SELECT)) && - input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(L)) && - input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(R)) && - input_cb(0, RETRO_DEVICE_JOYPAD, 0, _BIND(DOWN)); + if(g_reset && id == RETRO_DEVICE_ID_JOYPAD_RESET) + { + state = true; + id = RETRO_DEVICE_ID_JOYPAD_RESET; + g_reset = false; + } + else + { + bool button_combo_down = + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R); + bool service_pressed = ((id == RETRO_DEVICE_ID_JOYPAD_SERVICE) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT) + && button_combo_down); + bool diag_pressed = ((id == RETRO_DEVICE_ID_JOYPAD_DIAGNOSTIC) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START) + && button_combo_down); + bool reset_pressed = ((id == RETRO_DEVICE_ID_JOYPAD_RESET) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT) + && button_combo_down); + bool dip_a_pressed = ((id == RETRO_DEVICE_ID_JOYPAD_DIP_A) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT) + && button_combo_down); + bool dip_b_pressed = ((id == RETRO_DEVICE_ID_JOYPAD_DIP_B) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP) + && button_combo_down); + bool test_pressed = ((id == RETRO_DEVICE_ID_JOYPAD_TEST) && + input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN) + && button_combo_down); + + state = diag_pressed || service_pressed || reset_pressed || dip_a_pressed + || dip_b_pressed || test_pressed; + } + Reinitialise(); } else - state = input_cb(port, RETRO_DEVICE_JOYPAD, 0, s); + state = input_cb(port, RETRO_DEVICE_JOYPAD, 0, id); + + //fprintf(stderr, "GIT_SWITCH: %s, port: %d, pressed: %d.\n", print_label(id), port, state); if (pgi->nType & BIT_GROUP_ANALOG) { @@ -1477,7 +1600,7 @@ static void poll_input(void) break; } case GIT_KEYSLIDER: // Keyboard slider - case GIT_JOYSLIDER: // Joystick slider + //fprintf(stderr, "GIT_JOYSLIDER\n"); { int nSlider = pgi->Input.Slider.nSliderValue; if (pgi->nType == BIT_ANALOG_REL) { diff --git a/src/burner/libretro/tchar.h b/src/burner/libretro/tchar.h index fad806e9a..e3934d58e 100644 --- a/src/burner/libretro/tchar.h +++ b/src/burner/libretro/tchar.h @@ -5,45 +5,38 @@ #include #include "inp_keys.h" +#define TCHAR char +#define _T(x) x +#define _tfopen fopen +#define _tcstol strtol +#define _tcsstr strstr +#define _istspace(x) isspace(x) +#define _stprintf sprintf +#define _tcslen strlen +#define _tcsicmp(a, b) strcasecmp(a, b) +#define _tcscpy(to, from) strcpy(to, from) +#define _fgetts fgets +#define _strnicmp(s1, s2, n) strncasecmp(s1, s2, n) +#define _tcsncmp strncmp +#define _tcsncpy strncpy +#define _stscanf sscanf +#define _ftprintf fprintf #ifdef _MSC_VER #include -#endif +#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) +#define strcasecmp(x, y) _stricmp(x, y) +#define snprintf _snprintf +#else +#define _stricmp(x, y) strcasecmp(x,y) typedef struct { int x, y, width, height; } RECT; - -#define TCHAR char #undef __cdecl #define __cdecl #define bprintf(...) {} -#define _strnicmp(s1, s2, n) strncasecmp(s1, s2, n) -#define _stricmp(x, y) strcasecmp(x,y) - -#ifdef _MSC_VER -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) -#define strcasecmp(x, y) _stricmp(x, y) -#define snprintf _snprintf #endif -#define _T(x) x -#define _tcstol strtol -#define _tfopen fopen -#define _fgetts fgets -#define _tcslen strlen -#define _stprintf sprintf -#define _istspace(x) isspace(x) -#define _tcsncmp strncmp -#define _tcsncpy strncpy -#define _tcsstr strstr -#define _stscanf sscanf -#define _ftprintf fprintf -#ifndef _MSC_VER -#define _tcsicmp(a, b) strcasecmp(a, b) -#endif -#define _tcscpy(to, from) strcpy(to, from) -/*define lstrlen what does lstrlen correspond to?*/ - #undef __fastcall #undef _fastcall #define __fastcall /*what does this correspond to?*/