Skip to content

Commit

Permalink
Aggiunte tre nuove opzioni.
Browse files Browse the repository at this point in the history
Aggiunte nel menu Settings/Video le opzioni :
- "Input_display"
- "Disable TV noise emulation when turned off"
- "Disable sepia color on pause".
  • Loading branch information
punesemu committed Nov 7, 2016
1 parent 25befb5 commit 49958dc
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 50 deletions.
15 changes: 15 additions & 0 deletions src/core/cmd_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ static const struct option opt_long[] = {
{ "version", no_argument, NULL, 'V'},
{ "portable", no_argument, NULL, 0 },
{ "txt-on-screen", required_argument, NULL, 0 },
{ "input-display", required_argument, NULL, 0 },
{ "disable-tv-noise", required_argument, NULL, 0 },
{ "disable-sepia", required_argument, NULL, 0 },
#if defined (WITH_OPENGL)
{ "disable-srgb-fbo", required_argument, NULL, 0 },
#endif
Expand Down Expand Up @@ -99,6 +102,12 @@ BYTE cmd_line_parse(int argc, char **argv) {
/* l'ho gia' controllato quindi qui non faccio niente */
} else if (!(strcmp(opt_long[longIndex].name, "txt-on-screen"))) {
set_int(cfg_from_file.txt_on_screen, SET_TEXT_ON_SCREEN);
} else if (!(strcmp(opt_long[longIndex].name, "input-display"))) {
set_int(cfg_from_file.input_display, SET_INPUT_DISPLAY);
} else if (!(strcmp(opt_long[longIndex].name, "disable-tv-noise"))) {
set_int(cfg_from_file.disable_tv_noise, SET_DISABLE_TV_NOISE);
} else if (!(strcmp(opt_long[longIndex].name, "disable-sepia"))) {
set_int(cfg_from_file.disable_sepia_color, SET_DISABLE_SEPIA_PAUSE);
#if defined (WITH_OPENGL)
} else if (!(strcmp(opt_long[longIndex].name, "disable-srgb-fbo"))) {
set_int(cfg_from_file.disable_srgb_fbo, SET_DISABLE_SRGB_FBO);
Expand Down Expand Up @@ -277,6 +286,9 @@ void usage(char *name) {
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
#if defined (WITH_OPENGL)
"%s\n"
"%s\n"
Expand All @@ -302,6 +314,9 @@ void usage(char *name) {
main_cfg[SET_VSYNC].hlp,
main_cfg[SET_INTERPOLATION].hlp,
main_cfg[SET_TEXT_ON_SCREEN].hlp,
main_cfg[SET_INPUT_DISPLAY].hlp,
main_cfg[SET_DISABLE_TV_NOISE].hlp,
main_cfg[SET_DISABLE_SEPIA_PAUSE].hlp,
#if defined (WITH_OPENGL)
main_cfg[SET_DISABLE_SRGB_FBO].hlp,
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/core/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ typedef struct _config {
BYTE interpolation;
BYTE cheat_mode;
BYTE txt_on_screen;
BYTE input_display;
BYTE disable_tv_noise;
BYTE disable_sepia_color;
#if defined (WITH_OPENGL)
BYTE disable_srgb_fbo;
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/core/database.h
Original file line number Diff line number Diff line change
Expand Up @@ -3887,6 +3887,8 @@ static const _dbelement dblist[] = {
{"5421c38840e5fbef1140f1f8cfe42b5dc7b8096c", UNIF_MAPPER, 30, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, NODIPSWITCH, NOEXTRA},
/* Mi Hun Che (Ch)(replaced copyrights)[p1][!].nes */
{"230f514c80b5dfbe6a86f3e24947ad34c0235835", UNIF_MAPPER, 30, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, NODIPSWITCH, NOEXTRA},
/* Super Car (Ch)(full copyrights)[!].nes */
{"31b3e7cfb2069ca9f52aa2f4c9ce295d722432cf", UNIF_MAPPER, 30, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, NODIPSWITCH, NOEXTRA},

};

Expand Down
99 changes: 59 additions & 40 deletions src/core/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void text_init(void) {
ele->y = 1 * font_size[ele->font][1];

// tas controllers
for (i = 0; i < 4; i++) {
for (i = 0; i < PORT_MAX; i++) {
ele = &text.tas.controllers[i];
ele->bck = TRUE;
ele->bck_color = TXT_BLUE;
Expand Down Expand Up @@ -344,19 +344,31 @@ void text_rendering(BYTE render) {
rendering(ele);
}
}
}

{
ele = &text.tas.controllers[0];
if (tas.type | cfg->input_display) {
uint8_t i;

for (i = 0; i < PORT_MAX; i++) {
ele = &text.tas.controllers[i];

if (port[i].type != CTRL_STANDARD) {
if (ele->surface) {
text_clear(ele);
gfx_text_release_surface(ele);
}
continue;
}

ele->text[0] = 0;
port_control(port[PORT1], UP, "[up]");
port_control(port[PORT1], DOWN, "[down]");
port_control(port[PORT1], LEFT, "[left]");
port_control(port[PORT1], RIGHT, "[right]");
port_control(port[PORT1], SELECT, "[select]");
port_control(port[PORT1], START, "[start]");
port_control(port[PORT1], BUT_A, "[a]");
port_control(port[PORT1], BUT_B, "[b]");
port_control(port[i], UP, "[up]");
port_control(port[i], DOWN, "[down]");
port_control(port[i], LEFT, "[left]");
port_control(port[i], RIGHT, "[right]");
port_control(port[i], SELECT, "[select]");
port_control(port[i], START, "[start]");
port_control(port[i], BUT_A, "[a]");
port_control(port[i], BUT_B, "[b]");

if (!ele->surface) {
gfx_text_create_surface(ele);
Expand Down Expand Up @@ -454,6 +466,34 @@ void text_rendering(BYTE render) {
}
}
}
void text_calculate_real_x_y(_txt_element *ele, int *x, int *y) {
(*x) = ele->x;
(*y) = ele->y;
if (ele->start_x >= TXT_CENTER) {
if (ele->start_x == TXT_CENTER) {
(*x) = ((text.w - ele->w) >> 1) + ele->x;
} else if (ele->start_x == TXT_LEFT) {
(*x) = 8 + ele->x;
} else if (ele->start_x == TXT_RIGHT) {
(*x) = ((text.w - 8) - ele->w) + ele->x;
}
if ((*x) < 0) {
(*x) = 0;
}
}
if (ele->start_y >= TXT_CENTER) {
if (ele->start_y == TXT_CENTER) {
(*y) = ((text.h - (ele->factor * font_size[ele->font][1])) >> 1) + ele->y;
} else if (ele->start_y == TXT_UP) {
(*y) = 8 + ele->y;
} else if (ele->start_y == TXT_DOWN) {
(*y) = ((text.h - 8) - font_size[ele->font][1]) + ele->y;
}
if ((*y) < 0) {
(*y) = 0;
}
}
}
void text_quit(void) {
_txt_element *ele;
int i;
Expand Down Expand Up @@ -493,7 +533,7 @@ void text_quit(void) {
gfx_text_release_surface(ele);
}

for (i = 0; i < 4; i++) {
for (i = 0; i < PORT_MAX; i++) {
ele = text.tas.controllers;

if (ele->surface) {
Expand Down Expand Up @@ -544,36 +584,15 @@ static void INLINE rendering(_txt_element *ele) {
font.x = 0;
font.w = ele->factor * font_size[ch_font][0];

surface_rect.x = ele->x;
surface_rect.y = ele->y;
surface_rect.w = ele->w;
surface_rect.h = ele->h;
{
int x, y;

if (ele->start_x >= TXT_CENTER) {
if (ele->start_x == TXT_CENTER) {
surface_rect.x = ((text.w - ele->w) >> 1) + ele->x;
} else if (ele->start_x == TXT_LEFT) {
surface_rect.x = 8 + ele->x;
} else if (ele->start_x == TXT_RIGHT) {
surface_rect.x = ((text.w - 8) - ele->w) + ele->x;
}
if (surface_rect.x < 0) {
surface_rect.x = 0;
}
}
text_calculate_real_x_y(ele, &x, &y);

if (ele->start_y >= TXT_CENTER) {
if (ele->start_y == TXT_CENTER) {
surface_rect.y = ((text.h - (ele->factor * font_size[ch_font][1])) >> 1)
+ ele->y;
} else if (ele->start_y == TXT_UP) {
surface_rect.y = 8 + ele->y;
} else if (ele->start_y == TXT_DOWN) {
surface_rect.y = ((text.h - 8) - font_size[ch_font][1]) + ele->y;
}
if (surface_rect.y < 0) {
surface_rect.y = 0;
}
surface_rect.x = x;
surface_rect.y = y;
surface_rect.w = ele->w;
surface_rect.h = ele->h;
}

color[0] = (ele->alpha[0] << 24) | txt_table[TXT_NORMAL];
Expand Down
1 change: 1 addition & 0 deletions src/core/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ EXTERNC void text_save_slot(BYTE operation);
EXTERNC void text_add_line(int type, int factor, int font, int alpha, int start_x, int start_y,
int x, int y, const char *fmt, ...);
EXTERNC void text_rendering(BYTE render);
EXTERNC void text_calculate_real_x_y(_txt_element *ele, int *x, int *y);
EXTERNC void text_quit(void);

EXTERNC void (*text_clear)(_txt_element *ele);
Expand Down
29 changes: 28 additions & 1 deletion src/gui/designer/application.ui
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,13 @@
<addaction name="menu_Shader"/>
<addaction name="menu_Palette"/>
<addaction name="separator"/>
<addaction name="action_Disable_emphasis_swap_PAL"/>
<addaction name="action_VSync"/>
<addaction name="action_Interpolation"/>
<addaction name="action_Text_on_screen"/>
<addaction name="action_Input_display"/>
<addaction name="action_Disable_emphasis_swap_PAL"/>
<addaction name="action_Disable_TV_noise_emulation"/>
<addaction name="action_Disable_sepia_color_on_pause"/>
<addaction name="action_Disable_sRGB_FBO"/>
<addaction name="action_Stretch_in_fullscreen"/>
</widget>
Expand Down Expand Up @@ -2139,6 +2142,30 @@
<string>&amp;Turn Off</string>
</property>
</action>
<action name="action_Input_display">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Input displa&amp;y</string>
</property>
</action>
<action name="action_Disable_TV_noise_emulation">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Disable TV &amp;noise emulation when turned off</string>
</property>
</action>
<action name="action_Disable_sepia_color_on_pause">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Disable sepi&amp;a color on pause</string>
</property>
</action>
</widget>
<resources>
<include location="application.qrc"/>
Expand Down
28 changes: 28 additions & 0 deletions src/gui/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,9 @@ void mainWindow::update_menu_settings() {
ui->action_VSync->setChecked(cfg->vsync);
ui->action_Interpolation->setChecked(cfg->interpolation);
ui->action_Text_on_screen->setChecked(cfg->txt_on_screen);
ui->action_Input_display->setChecked(cfg->input_display);
ui->action_Disable_TV_noise_emulation->setChecked(cfg->disable_tv_noise);
ui->action_Disable_sepia_color_on_pause->setChecked(cfg->disable_sepia_color);
#if defined (WITH_OPENGL)
ui->action_Disable_sRGB_FBO->setChecked(cfg->disable_srgb_fbo);
#endif
Expand Down Expand Up @@ -1555,6 +1558,9 @@ void mainWindow::connect_menu_signals() {
connect_action(ui->action_VSync, SLOT(s_set_vsync()));
connect_action(ui->action_Interpolation, SLOT(s_set_interpolation()));
connect_action(ui->action_Text_on_screen, SLOT(s_set_txt_on_screen()));
connect_action(ui->action_Input_display, SLOT(s_set_input_display()));
connect_action(ui->action_Disable_TV_noise_emulation, SLOT(s_set_disable_tv_noise()));
connect_action(ui->action_Disable_sepia_color_on_pause, SLOT(s_set_disable_sepia_pause()));
#if defined (WITH_OPENGL)
connect_action(ui->action_Disable_sRGB_FBO, SLOT(s_set_disable_srgb_fbo()));
#endif
Expand Down Expand Up @@ -2159,6 +2165,28 @@ void mainWindow::s_set_interpolation() {
void mainWindow::s_set_txt_on_screen() {
cfg->txt_on_screen = !cfg->txt_on_screen;
}
void mainWindow::s_set_input_display() {
cfg->input_display = !cfg->input_display;

if (!cfg->input_display) {
BYTE i;

for (i = 0; i < PORT_MAX; i++) {
_txt_element *ele = &text.tas.controllers[i];

if (ele->surface) {
text_clear(ele);
gfx_text_release_surface (ele);
}
}
}
}
void mainWindow::s_set_disable_tv_noise() {
cfg->disable_tv_noise = !cfg->disable_tv_noise;
}
void mainWindow::s_set_disable_sepia_pause() {
cfg->disable_sepia_color = !cfg->disable_sepia_color;
}
#if defined (WITH_OPENGL)
void mainWindow::s_set_disable_srgb_fbo() {
cfg->disable_srgb_fbo = !cfg->disable_srgb_fbo;
Expand Down
3 changes: 3 additions & 0 deletions src/gui/mainWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ class mainWindow: public QMainWindow {
void s_set_vsync();
void s_set_interpolation();
void s_set_txt_on_screen();
void s_set_input_display();
void s_set_disable_tv_noise();
void s_set_disable_sepia_pause();
#if defined (WITH_OPENGL)
void s_set_disable_srgb_fbo();
#endif
Expand Down
22 changes: 22 additions & 0 deletions src/gui/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ enum set_element {
SET_VSYNC,
SET_INTERPOLATION,
SET_TEXT_ON_SCREEN,
SET_INPUT_DISPLAY,
SET_DISABLE_TV_NOISE,
SET_DISABLE_SEPIA_PAUSE,
#if defined (WITH_OPENGL)
SET_DISABLE_SRGB_FBO,
#endif
Expand Down Expand Up @@ -638,6 +641,25 @@ static const _settings main_cfg[] = {
" --txt-on-screen enable messages : yes, no",
{LENGTH(opt_no_yes), opt_no_yes}
},
{
"video", "input display", "no",
"# possible values: yes, no",
" --input-display enable input gui : yes, no",
{LENGTH(opt_no_yes), opt_no_yes}
},
{
"video", "disable tv noise emulation", "no",
"# possible values: yes, no",
" --disable-tv-noise disable tv noise : yes, no",
{LENGTH(opt_no_yes), opt_no_yes}
},
{
"video", "disable sepia color on pause", "no",
"# possible values: yes, no",
" --disable-sepia disable sepia color : yes, no" NEWLINE
" during the pause",
{LENGTH(opt_no_yes), opt_no_yes}
},
#if defined (WITH_OPENGL)
{
"video", "disable sRGB FBO (Shaders)", "no",
Expand Down
6 changes: 6 additions & 0 deletions src/gui/settingsObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,9 @@ void setObject::to_cfg(QString group) {
int_to_val(SET_VSYNC, cfg_from_file.vsync);
int_to_val(SET_INTERPOLATION, cfg_from_file.interpolation);
int_to_val(SET_TEXT_ON_SCREEN, cfg_from_file.txt_on_screen);
int_to_val(SET_INPUT_DISPLAY, cfg_from_file.input_display);
int_to_val(SET_DISABLE_TV_NOISE, cfg_from_file.disable_tv_noise);
int_to_val(SET_DISABLE_SEPIA_PAUSE, cfg_from_file.disable_sepia_color);
#if defined (WITH_OPENGL)
int_to_val(SET_DISABLE_SRGB_FBO, cfg_from_file.disable_srgb_fbo);
#endif
Expand Down Expand Up @@ -820,6 +823,9 @@ void setObject::fr_cfg(QString group) {
cfg_from_file.vsync = val_to_int(SET_VSYNC);
cfg_from_file.interpolation = val_to_int(SET_INTERPOLATION);
cfg_from_file.txt_on_screen = val_to_int(SET_TEXT_ON_SCREEN);
cfg_from_file.input_display = val_to_int(SET_INPUT_DISPLAY);
cfg_from_file.disable_tv_noise = val_to_int(SET_DISABLE_TV_NOISE);
cfg_from_file.disable_sepia_color= val_to_int(SET_DISABLE_SEPIA_PAUSE);
#if defined (WITH_OPENGL)
cfg_from_file.disable_srgb_fbo = val_to_int(SET_DISABLE_SRGB_FBO);
#endif
Expand Down

0 comments on commit 49958dc

Please sign in to comment.