mirror of https://github.com/snes9xgit/snes9x.git
change crosshairs
This commit is contained in:
parent
ade94ccac6
commit
b29666ef26
|
@ -13,6 +13,7 @@
|
|||
#include "logger.h"
|
||||
#include "display.h"
|
||||
#include "conffile.h"
|
||||
#include "crosshairs.h"
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
|
@ -192,6 +193,12 @@ void retro_set_environment(retro_environment_t cb)
|
|||
{ "snes9x_overscan", "Crop overscan; enabled|disabled|auto" },
|
||||
{ "snes9x_aspect", "Preferred aspect ratio; 4:3|8:7|auto|ntsc|pal" },
|
||||
{ "snes9x_region", "Console region (Reload core); auto|ntsc|pal" },
|
||||
{ "snes9x_superscope_crosshair", "Super Scope crosshair; 2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|0|1" },
|
||||
{ "snes9x_superscope_color", "Super Scope color; White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)|Blue|Blue (blend)|Violet|Violet (blend)|Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Gray|25% Gray (blend)|50% Gray|50% Gray (blend)|75% Gray|75% Gray (blend)" },
|
||||
{ "snes9x_justifier1_crosshair", "Justifier 1 crosshair; 4|5|6|7|8|9|10|11|12|13|14|15|16|0|1|2|3" },
|
||||
{ "snes9x_justifier1_color", "Justifier 1 color; Blue|Blue (blend)|Violet|Violet (blend)|Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Gray|25% Gray (blend)|50% Gray|50% Gray (blend)|75% Gray|75% Gray (blend)|White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)" },
|
||||
{ "snes9x_justifier2_crosshair", "Justifier 2 crosshair; 4|5|6|7|8|9|10|11|12|13|14|15|16|0|1|2|3" },
|
||||
{ "snes9x_justifier2_color", "Justifier 2 color; Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Gray|25% Gray (blend)|50% Gray|50% Gray (blend)|75% Gray|75% Gray (blend)|White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)|Blue|Blue (blend)|Violet|Violet (blend)" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
|
@ -233,6 +240,54 @@ void retro_set_environment(retro_environment_t cb)
|
|||
environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
|
||||
}
|
||||
|
||||
char *get_cursor_color(const char *name)
|
||||
{
|
||||
static char color_names[][32] = {
|
||||
"Black", "Black",
|
||||
"Black (blend)", "tBlack",
|
||||
"25% Grey", "25Grey",
|
||||
"25% Grey (blend)", "t25Grey",
|
||||
"50% Grey", "50Grey",
|
||||
"50% Grey (blend)", "t50Grey",
|
||||
"75% Grey", "75Grey",
|
||||
"75% Grey (blend)", "t75Grey",
|
||||
"White", "White",
|
||||
"White (blend)", "tWhite",
|
||||
"Red", "Red",
|
||||
"Red (blend)", "tRed",
|
||||
"Orange", "Orange",
|
||||
"Orange (blend)", "tOrange",
|
||||
"Yellow", "Yellow",
|
||||
"Yellow (blend)", "tYellow",
|
||||
"Green", "Green",
|
||||
"Green (blend)", "tGreen",
|
||||
"Cyan", "Cyan",
|
||||
"Cyan (blend)", "tCyan",
|
||||
"Sky", "Sky",
|
||||
"Sky (blend)", "tSky",
|
||||
"Blue", "Blue",
|
||||
"Blue (blend)", "tBlue",
|
||||
"Violet", "Violet",
|
||||
"Violet (blend)", "tViolet",
|
||||
"Pink", "MagicPink",
|
||||
"Pink (blend)", "tMagicPink",
|
||||
"Purple", "Purple",
|
||||
"Purple (blend)", "tPurple",
|
||||
"\0", "\0"
|
||||
};
|
||||
|
||||
int lcv = 0;
|
||||
while (color_names[lcv][0]) {
|
||||
if (strcmp(color_names[lcv], name) == 0) {
|
||||
return color_names[lcv+1];
|
||||
}
|
||||
|
||||
lcv += 2;
|
||||
}
|
||||
|
||||
return "None";
|
||||
}
|
||||
|
||||
void update_geometry(void)
|
||||
{
|
||||
struct retro_system_av_info av_info;
|
||||
|
@ -434,6 +489,72 @@ static void update_variables(void)
|
|||
}
|
||||
}
|
||||
|
||||
var.key="snes9x_superscope_crosshair";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
int crosshair;
|
||||
|
||||
sscanf (var.value,"%d",&crosshair);
|
||||
S9xSetControllerCrosshair(X_SUPERSCOPE, crosshair, 0, 0);
|
||||
}
|
||||
|
||||
var.key="snes9x_superscope_color";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
char *color = get_cursor_color(var.value);
|
||||
|
||||
if (color[0] == 't')
|
||||
S9xSetControllerCrosshair(X_SUPERSCOPE, -1, get_cursor_color(var.value), "tBlack");
|
||||
else
|
||||
S9xSetControllerCrosshair(X_SUPERSCOPE, -1, get_cursor_color(var.value), "Black");
|
||||
}
|
||||
|
||||
var.key="snes9x_justifier1_crosshair";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
int crosshair;
|
||||
|
||||
sscanf (var.value,"%d",&crosshair);
|
||||
S9xSetControllerCrosshair(X_JUSTIFIER1, crosshair, 0, 0);
|
||||
}
|
||||
|
||||
var.key="snes9x_justifier1_color";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
char *color = get_cursor_color(var.value);
|
||||
|
||||
if (color[0] == 't')
|
||||
S9xSetControllerCrosshair(X_JUSTIFIER1, -1, get_cursor_color(var.value), "tBlack");
|
||||
else
|
||||
S9xSetControllerCrosshair(X_JUSTIFIER1, -1, get_cursor_color(var.value), "Black");
|
||||
}
|
||||
|
||||
var.key="snes9x_justifier2_crosshair";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
int crosshair;
|
||||
|
||||
sscanf (var.value,"%d",&crosshair);
|
||||
S9xSetControllerCrosshair(X_JUSTIFIER2, crosshair, 0, 0);
|
||||
}
|
||||
|
||||
var.key="snes9x_justifier2_color";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
char *color = get_cursor_color(var.value);
|
||||
|
||||
if (color[0] == 't')
|
||||
S9xSetControllerCrosshair(X_JUSTIFIER2, -1, get_cursor_color(var.value), "tBlack");
|
||||
else
|
||||
S9xSetControllerCrosshair(X_JUSTIFIER2, -1, get_cursor_color(var.value), "Black");
|
||||
}
|
||||
|
||||
if (geometry_update)
|
||||
update_geometry();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue